Cannot distinguish between template function wtih 0 args and 1 arg
ag0aep6g via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Aug 8 03:16:48 PDT 2016
On 08/08/2016 04:36 AM, Engine Machine wrote:
> 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__)()
Going backwards:
func is "main.Winmain" - ok.
line is 38u - ok.
file is "main.d" - ok.
B is cast(eException)1280L - B seems to be a type parameter, can't be a
value.
T is missing.
The compiler goes forwards, not backwards, of course, so everything is
mismatched.
[...]
> 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).
That doesn't look like the instantiation that causes the error. You've
got five template arguments here, but in the error there are only four.
Can you post more complete code? Something doesn't add up here.
More information about the Digitalmars-d-learn
mailing list