overloads and parents. __traits confusion

John Colvin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Aug 11 06:00:25 PDT 2014


can someone talk me through the reasoning behind this:

import std.typetuple;

void foo(T)(T v){}
void foo(){}

version(ThisCompiles)
{
     alias Parent = TypeTuple!(__traits(parent, foo))[0];

     pragma(msg, __traits(getOverloads, Parent, "foo"));
// tuple()
}
else
{
     alias Parent = TypeTuple!(__traits(parent, foo!float))[0];

     pragma(msg, __traits(getOverloads, Parent, "foo"));
/*
/d54/f131.d(8): Error: foo (float v) is not callable using 
argument types () /d54/f131.d(8): Error: (__error).foo cannot be 
resolved
tuple()
*/
}


More information about the Digitalmars-d-learn mailing list