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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Nov 18 23:00:20 PST 2013


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 at puremagic.com
        ReportedBy: opantm2+dbugs at gmail.com


--- Comment #0 from Kapps <opantm2+dbugs at 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: -------


More information about the Digitalmars-d-bugs mailing list