www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15156] New: overload set in eponymous template

https://issues.dlang.org/show_bug.cgi?id=15156

          Issue ID: 15156
           Summary: overload set in eponymous template
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: john.loughran.colvin gmail.com

void bish0(T)(string arg, string barg){}
void bish1(T)(int argi, string barg){}

template bish(T)
{
    alias bish = bish0!T;
    alias bish = bish1!T;
}

void main(string[] args)
{
    alias b = bish!string;
    b("","");
}

/d112/f630.d(17): Error: function expected before (), not bish!string of type
void

There is an easy workaround:

template bish(T)
{
    alias tmp = bish0!T;
    alias tmp = bish1!T;
    alias bish = tmp;
}

but it seems to me like it should just work the first way.

--
Oct 04 2015