www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12746] New: Wrong overload access within manually aliased

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

          Issue ID: 12746
           Summary: Wrong overload access within manually aliased
                    eponymous function template
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

This is invalid code, but incorrectly accepted and asserts in runtime.

template foo()
{
    void bar()
    {
        bar(1); // incorrectly call foo(int)
    }
    alias foo = bar;
}

void foo(int)
{
    assert(0);
}

void main()
{
    foo();
}

--
May 14 2014