www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11548] New: ParameterDefaultValueTuple fails to compile when passed in a function containing a parameter named "args".

https://d.puremagic.com/issues/show_bug.cgi?id=11548

           Summary: ParameterDefaultValueTuple fails to compile when
                    passed in a function containing a parameter named
                    "args".
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: opantm2+dbugs gmail.com


--- Comment #0 from Kapps <opantm2+dbugs gmail.com> 2013-11-18 23:00:18 PST ---
From what I can tell, the template seems to use the name of the arguments as
part of a lambda, while declaring "args" itself. So when one of the parameters
is named args, this creates a duplicate definition and fails to compile.

Sample code:

import std.traits;

void foo(string[] args) { }

void main() {
    alias T = ParameterDefaultValueTuple!foo;    
}

Output:

Ognjen:~$ rdmd test.d
/Users/kapps/dev/dmd/phobos/std/traits.d(1093): Error: delegate
std.traits.ParameterDefaultValueTuple!(foo).Get!(0LU).__lambda2 parameter
__lambda2.args is already defined
/Users/kapps/dev/dmd/phobos/std/traits.d(1122): Error: template instance
std.traits.ParameterDefaultValueTuple!(foo).Get!(0LU) error instantiating
/Users/kapps/dev/dmd/phobos/std/traits.d(1125):        instantiated from here:
Impl!()
test.d(20):        instantiated from here: ParameterDefaultValueTuple!(foo)
/Users/kapps/dev/dmd/phobos/std/traits.d(1125): Error: template instance
std.traits.ParameterDefaultValueTuple!(foo).Impl!() error instantiating
test.d(20):        instantiated from here: ParameterDefaultValueTuple!(foo)
test.d(20): Error: template instance
std.traits.ParameterDefaultValueTuple!(foo) error instantiating

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 18 2013