Ok, it all boils down to this:
===================================== a.h ======================================
#ifndef _A_H_
#define _A_H_
class A {
public:
int a(void);
};
class B : public A {
public:
int b(void);
};
#endif /* _A_H_ */
================================================================================
==================================== a.cpp =====================================
#include "a.h"
int
A::a(void) {
return 1;
}
int
B::b(void) {
return 2;
}
================================================================================
g++ -shared -o liba.so a.cpp
===================================== a.pl =====================================
#!/home/neuron/.rakudobrew/bin/perl6
use NativeCall;
class A is repr<CPPStruct> {
has Pointer $.vtable;
method a is native('./a') returns Int { * };
}
class B is A {
method b is native('./a') returns Int { * };
}
A.new.a.say; # works
B.new.a.say; # err 1
B.new.b.say; # err 2
================================================================================
err 1:
Native call expected return type with CPPStruct representation, but got a
P6opaque (B)
in method CALL-ME at
/home/neuron/.rakudobrew/moar-nom/install/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03
(NativeCall) line 328
in block <unit> at ./a.pl line 16
err 2:
Unknown type B used in native call.
If you want to pass a struct, be sure to use the CStruct or
CPPStruct representation.
If you want to pass an array, be sure to use the CArray type.
in sub type_code_for at
/home/neuron/.rakudobrew/moar-nom/install/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03
(NativeCall) line 174
in sub param_hash_for at
/home/neuron/.rakudobrew/moar-nom/install/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03
(NativeCall) line 71
in sub param_list_for at
/home/neuron/.rakudobrew/moar-nom/install/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03
(NativeCall) line 89
in method setup at
/home/neuron/.rakudobrew/moar-nom/install/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03
(NativeCall) line 304
in method CALL-ME at
/home/neuron/.rakudobrew/moar-nom/install/share/perl6/sources/24DD121B5B4774C04A7084827BFAD92199756E03
(NativeCall) line 317
in block <unit> at ./a.pl line 17
Does it make sense to file this bug?
Thank you
__
Vlad