Skip to content

Cannot virtualize a function with optional argument  #653

Open
@HGuillemet

Description

GIven this C++ function:

class M {
  public:
    virtual void f(bool b = true) {  }
};

The parser generates two methods:

    public native void f(@Cast("bool") boolean b/*=true*/);
    public native void f();

I want to virtualize f.
If I virtualize both methods:

    @Virtual public native void f(@Cast("bool") boolean b/*=true*/);
    @Virtual public native void f();

The generator produces a subclass with:

virtual void f() override;

that doesn't compile (error "marked override but doesn't override").
If I virtualize only one:

@Virtual public native void f(@Cast("bool") boolean on/*=true*/);
public native void f();

The generator produces a wrapper with:

          (dynamic_cast<JavaCPP_M*>(ptr) != NULL ? ((JavaCPP_M*)ptr)->f() : ptr->f());

that doesn't compile either (error "no matching function for call to 'JavaCPP_M::f()'").

Did I miss something or is there something to fix ?

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions