Thread overview
[Issue 9894] New: Member func of templated struct can't pass varargs to templated member func
Apr 07, 2013
Nick Sabalausky
Apr 07, 2013
Nick Sabalausky
Apr 07, 2013
Nick Sabalausky
Apr 07, 2013
Kenji Hara
April 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9894

           Summary: Member func of templated struct can't pass varargs to
                    templated member func
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: cbkbbejeap@mailinator.com


--- Comment #0 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2013-04-06 19:34:17 PDT ---
struct Foo(TArgs...) {
     void func(TArgs args) { func2(args); }
     void func2()(TArgs args) {}
}

void main() {
     Foo!(int).func(5);
}

DMD output:
test.d(2): Error: template test.Foo!(int).Foo.func2 does not match any function
template declaration. Candidates are:
test.d(3):        test.Foo!(int).Foo.func2()(TArgs args)
test.d(2): Error: template test.Foo!(int).Foo.func2()(TArgs args) cannot deduce
template function from argument types !()(int)
test.d(7): Error: template instance test.Foo!(int) error instantiating

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9894



--- Comment #1 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2013-04-06 19:36:59 PDT ---
Note that if func2 is *NOT* a template, then it works.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9894



--- Comment #2 from Nick Sabalausky <cbkbbejeap@mailinator.com> 2013-04-06 19:45:48 PDT ---
Workaround:

struct Foo(TArgs...) {
    void func(TArgs args) { this.workaround(args); }
    void func2()(TArgs args) {}
}
void workaround(Struct, TArgs...)(Struct s, TArgs args)
{
    s.func2!()(args);
}

void main() {
    Foo!(int) f;
    f.func(5);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
April 07, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9894


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2013-04-07 02:19:47 PDT ---
*** This issue has been marked as a duplicate of issue 9885 ***

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