www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14516] New: Local shadows template parameter

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

          Issue ID: 14516
           Summary: Local shadows template parameter
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: andrei erdani.com

Just caught a bug in some code:

auto fun(string f = __FUNCTION__)()
{
    string f = "abc";
    return f;
}

void main()
{
    assert(fun() == "abc"); // passes
}

In the spirit of avoidance of all hijacking/shadowing, this should probably be
an error.

--
Apr 27 2015