bytedeco/javacpp
Ver no GitHubCannot virtualize a function with optional argument
Open
#653 aberto em 17 de fev. de 2023
enhancementhelp wanted
Métricas do repositório
- Stars
- (4.279 stars)
- Métricas de merge de PR
- (Nenhuma PRs mesclada em 30d)
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 ?