| Issue 228: | -Dgeneric is broken? | |
| 1 person starred this issue and may be notified of changes. | Back to list |
polygonal-ds 1.38+ breaks when 'generic' is used.
Feb 16, 2013
dunno. all i heard was that polygonal-ds 1.38+ with -Dgeneric hits some hxcpp bug. i'm hoping Michael Baczynski will comment further here.
Feb 18, 2013
Hi, here is something that breaks (I can bake it down to a small code snippet if you want):
class Main {
public static function main() {
new de.polygonal.ds.ArrayedQueue<Int>(10).toDA();
}
}
I'm using latest haxe3 from svn and compiling with -D generic -D haxe3 flags. (It also fails with haxe 2.10).
error:
C:\SDKs\code.google\hxcpp\include\hx/Object.h(162) : error C2664: 'hx::ObjectPtr<OBJ_>::CastPtr' : cannot convert parameter 1 from 'de::polygonal::ds::DA_obj *const ' to 'hx::Object *'
with
[
OBJ_=de::polygonal::ds::DA_Int_obj
]
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
C:\SDKs\code.google\hxcpp\include\hx/Operators.h(241) : see reference to function template instantiation 'hx::ObjectPtr<OBJ_>::ObjectPtr<de::polygonal::ds::DA_obj>(const hx::ObjectPtr<de::polygonal::ds::DA_obj> &)' being compiled
with
[
OBJ_=de::polygonal::ds::DA_Int_obj
]
./src/Main.cpp(44) : see reference to function template instantiation 'hx::ObjectPtr<OBJ_> hx::TCast<T>::cast<de::polygonal::ds::DA_obj>(hx::ObjectPtr<de::polygonal::ds::DA_obj>)' being compiled
with
[
OBJ_=de::polygonal::ds::DA_Int_obj,
T=de::polygonal::ds::DA_Int
]
Feb 22, 2013
Hi,
This is due to the use of the unsafe 1-arg "cast" operator:
interface Comparable { function i():Void; }
class Main
{
public static function main()
{
var pivot:Comparable = null;
var b:Int = cast pivot;
}
}
In this case, "Int" simply does not implement the Comparable interface, and the "cast" operator prevents the haxe compiler from complaining.
Status:
WontFix
|
Hi, I tried this: commented out "Sprintf", because it is not haxe3 ready. Added "@:generic" to ObjectPool, as well as ObjectPoolIterator and then: import de.polygonal.ds.pooling.ObjectPool; class Test { static var x:ObjectPool<Test>; public static function main() { x = new ObjectPool<Test>(10); } } haxe -main Test -lib polygonal-ds -D generic -dce no -cpp cpp And it seemed to compile ok. Do you have a more tricky example?