You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extern class A { var a:Int; }
@:native("cpp::Reference<A>") extern class ARef extends A { }
extern class B extends ARef { var b:Int; }
@:native("cpp::Reference<B>") extern class BRef extends B
{
@:native("new B") static public function create () : BRef;
}
@:cppFileCode("
struct A { A() { a=1;} int a; };
struct B : public A { B() { b=2;} int b; };
")
class Test
{
public static function main()
{
var bref : BRef = BRef.create();
trace(bref.b);
var aref : ARef = bref;
trace(aref.a);
}
}
There's a problem when using unsafe cast on
cpp::Reference
:If we get a
BRef
we can't directly assign it a variable of typeARef
,but unsafe casting doesn't work either:
gives the following error with g++ both with the latest haxelib and github version:
and four candidate constructors.
Changing the toolchain to clang gives the same error
This doesn't happen on windows.
A more "real" example can be found in https://github.com/ianharrigan/hxWidgets/blob/master/src/hx/widgets/Frame.hx#L15 (
_ref
is defined in parent's parent class https://github.com/ianharrigan/hxWidgets/blob/master/src/hx/widgets/EvtHandler.hx#L12)The text was updated successfully, but these errors were encountered: