Member functions of extern classes annotated with :cpp.ValueType or :cpp.PointerType can only be directly invoked, attempting to create closures from these member functions will generate this error.
The following examples generate CPP0002.
@:semantics(value) @:cpp.ValueType extern class Foo { function new():Void; function bar():Void; } function main() { final f = new Foo(); final c = f.bar; // CPP0002 c(); }
@:semantics(value) @:cpp.PointerType extern class Foo { static function allocate():Foo; function bar():Void; } function main() { final f = Foo.allocate(); final c = f.bar; // CPP0002 c(); }