| Issue 47: | Strange Cpp-Compilation Error with enums and Type parameters | |
| 1 person starred this issue and may be notified of changes. | Back to list |
What steps will reproduce the problem?
try to compile the following code:
class TupleTools {
public static inline function fst <T,S>(t:Tuple<T,S>):T
{
return switch (t) { case Tuple(a, b): a; };
}
public static inline function snd <T,S>(t:Tuple<T,S>):S
{
return switch (t) { case Tuple(a, b): b; };
}
}
using Test.TupleTools;
enum Tuple<T,S> {
Tuple(a:T, b:S);
}
class Test
{
public static function main()
{
var t = Tuple(1, 2);
trace(t.fst());
trace(t.snd());
}
}
this is the compilation output:
haxelib run hxcpp Build.xml haxe -Dcpp -Dhaxe_205 -Dtrue
cl.exe -Iinclude -nologo -O2 -MT -DHX_WINDOWS -GR -Zi -c -EHsc -Id:\work\dev\haxe\hxcpp/include -D_CRT_SECURE_NO_DEPRECATE -wd4996 -Ychxcpp.h __pch.cpp /Fphxcpp.pch
__pch.cpp
cl.exe -I. -nologo -O2 -MT -DHX_WINDOWS -GR -Zi -c -EHsc -Id:\work\dev\haxe\hxcpp/include -D_CRT_SECURE_NO_DEPRECATE -wd4996 -Iinclude -Yuhxcpp.h ./src/Test.cpp -Foobj/Release/src/Test.obj
cl.exe -I. -nologo -O2 -MT -DHX_WINDOWS -GR -Zi -c -EHsc -Id:\work\dev\haxe\hxcpp/include -D_CRT_SECURE_NO_DEPRECATE -wd4996 -Iinclude -Yuhxcpp.h ./src/Tuple.cpp -Foobj/Release/src/Tuple.obj
Test.cpp
Tuple.cpp
./src/Test.cpp(10) : fatal error C1083: Cannot open include file: 'fst/S.h': No such file or directory
Called from <null> line 1
Called from BuildTool.hx line 883
Called from BuildTool.hx line 451
Called from BuildTool.hx line 474
Called from BuildTool.hx line 547
Called from BuildTool.hx line 618
Uncaught exception - Error in building thread
Error : Build failed
Aug 9, 2010
Fixed on haxe svn
Status:
Fixed
|
Slightly simplified code - it is the "inline" that is causing the problem. The resultant code refers to "used.UsedPrivate" from "main", which I think is a problem with the inlining code. class Usable { public static inline function used<UsedPrivate>( val:Templ<UsedPrivate> ) : UsedPrivate { return switch(val) { case Val(a): a; } } } enum Templ<T> { Val(a:T); } using Test.Usable; class Test { public static function main() { var t = Val(1); trace( t.used() ); } }