@@ -2314,6 +2314,8 @@ let cpp_can_static_cast funcType inferredType =
| TCppReference(_) | TCppStar(_) | TCppStruct(_) -> false
| _ ->
(match inferredType with
+ | TCppInst (cls, _) when is_extern_class cls -> false
+ | TCppEnum e when is_extern_enum e -> false
| TCppInst _
| TCppClass
| TCppEnum _
@@ -0,0 +1,41 @@
+package unit.issues;
+
+import utest.Assert;
+#if (cpp && !cppia)
+@:native('MY_DEFINE')
+extern class MyDefine {}
+@:unreflective
+@:structAccess
+@:native('my_extern')
+extern class MyExtern<T> {
+ function new();
+ function create() : T;
+}
+@:headerCode('
+typedef int MY_DEFINE;
+template<class T>
+class my_extern {
+public:
+ T create() {
+ return T();
+ }
+};
+')
+#end
+class Issue10876 extends Test {
+ #if (cpp && !cppia)
+ function test() {
+ final vec = cpp.Pointer.fromStar(new MyExtern<MyDefine>());
+ final num = vec.ptr.create();
+ Assert.equals(0, num);
+ #end