www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17219] New: variable shadowing and overload sets

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

          Issue ID: 17219
           Summary: variable shadowing and overload sets
           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 foo(alias bar)()
{
    static int bar0(T...)(T t) { return 0; }
    alias bar = bar0;
    import std.stdio;
    writeln(bar(3));
}

int blah(T)(T t) { return 1; }

void main()
{
    foo!blah;
}

currently this successfully compiles and prints 0. I think it should either
fail to compile ("bar already defined") or print 1 as blah and bar0 form an
overload set.

--
Feb 23 2017