[Issue 17219] New: variable shadowing and overload sets

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Feb 23 07:09:54 PST 2017


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 at puremagic.com
          Reporter: john.loughran.colvin at 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.

--


More information about the Digitalmars-d-bugs mailing list