Cannot distinguish between template function wtih 0 args and 1 arg

Engine Machine via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 7 19:36:24 PDT 2016


This really makes no sense

Error: template Mem cannot deduce function from argument types 
!(cast(eException)1280L, "main.d", 38u, "main.WinMain")(int), 
candidates are:
Mem(T, B = eX, string file = __FILE__, uint line = __LINE__, 
string func = __FUNCTION__)(size_t bytes)
Mem(T, B = eX, string file = __FILE__, uint line = __LINE__, 
string func = __FUNCTION__)()

Shouldn't these template functions be completely distinguished?

I tried to calling it with and without a value but same error. It 
is the only error.

This only occurs when I call it with the non-default template 
values:

I call it simply like Mem!(T, B, file, line, func)(34).

It seems if the template parameters match, that the compiler 
doesn't test the arguments.

Mem!T(34) works fine.






More information about the Digitalmars-d-learn mailing list