hxcpp icon indicating copy to clipboard operation
hxcpp copied to clipboard

Fix "cannot pass object of non-trivial type" errors in clang

Open RobDangerous opened this issue 5 years ago • 1 comments

clang doesn't like all of the PointerOf calls that might be happening. There's one of those problems with Arrays at Kode/Kha#1168 and I changed PointerOf(Dynamic) to PointerOf(ObjectPtr) to catch it. @nadako ran into the same problem with TNonGcStringSet as well so I added that too and just return 0. Not sure about that one though.

RobDangerous avatar Nov 29 '19 00:11 RobDangerous

This is a bit unfortunate - the real ("easy") fix is for the haxe compiler to generate these structs with with 'Dynamic' template type, rather than the specific object types - there should be no speed loss because the access to these members is Dynamic anyhow. This is how Array works and why its 'pointerOf' is so simple. Given that updating the haxe compiler is a long-term proposition, I think we need a new template arrangement in GcTypeInference, 'GcPointerOf' to extract the pointers. Using Dynamic or ObjectPtr<T> is not really enough since types will get missed (Dynamic does not match ObjectPtr). The full list of classes should be like MarkMember in GcTypeInference.h although perhaps Variant is not required.

hughsando avatar Nov 29 '19 01:11 hughsando

This has conflicts and there was no follow-up, so I'll assume that this can be closed.

Simn avatar Mar 27 '23 06:03 Simn