JakobOvrum/LuaD

Compilation fails due to template mismatch

Closed this issue · 4 comments

I just recently upgraded to the latest DMD (2.058) as well as to the latest LuaD, and it seems that there is an issue while trying to compile it on 64-bit Linux (tested in on Windows and it compiled just fine, so it's probably somewhat platform-specific). The errors that DMD gives me are:

../include/LuaD/luad/stack.d(321): Error: template luad.stack.getValue(T,alias typeMismatchHandler = defaultTypeMismatch) does not match any function template declaration
../include/LuaD/luad/stack.d(321): Error: template luad.stack.getValue(T,alias typeMismatchHandler = defaultTypeMismatch) cannot deduce template function from argument types !(LuaObject)(void**,ulong)
../include/LuaD/luad/stack.d(321): Error: template instance getValue!(LuaObject) errors instantiating template
../include/LuaD/luad/stack.d(324): Error: function luad.c.lua.lua_pop (void** L, int n) is not callable using argument types (void**,ulong)
../include/LuaD/luad/stack.d(324): Error: cannot implicitly convert expression (n) of type ulong to int
../include/LuaD/luad/state.d(248): Error: template instance luad.stack.popStack!(LuaObject) error instantiating

And my compilation script includes LuaD files in this order:

../include/LuaD/luad/*.d ../include/LuaD/luad/conversions/*.d ../include/LuaD/luad/c/*.d

Try now. There might be more 64-bit issues.

Hm, it fixed two of the the errors, but 4 more still remain:

../include/LuaD/luad/stack.d(321): Error: template luad.stack.getValue(T,alias typeMismatchHandler = defaultTypeMismatch) does not match any function template declaration
../include/LuaD/luad/stack.d(321): Error: template luad.stack.getValue(T,alias typeMismatchHandler = defaultTypeMismatch) cannot deduce template function from argument types !(LuaObject)(void**,ulong)
../include/LuaD/luad/stack.d(321): Error: template instance getValue!(LuaObject) errors instantiating template
../include/LuaD/luad/state.d(248): Error: template instance luad.stack.popStack!(LuaObject) error instantiating

Aha, it compiles correctly, if the line 321 of stack.d is changed to:

stack[i] = getValue!T(L, cast(int)(-n + i));

Aha, it compiles correctly, if the line 321 of stack.d is changed to:

This got snuck into the latest commit (3188850), forgot to split it out.

Thanks! I'll try to get a 64-bit testing environment sooner or later, I apologize for the inevitable issues in the meantime.