Bug 4905 – Variadic constructors don't compile for classes with other arguments

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-09-21T03:38:00Z
Last change time
2010-09-21T04:59:11Z
Assigned to
nobody
Creator
ivan.melnychuk+d
See also
http://d.puremagic.com/issues/show_bug.cgi?id=2596

Comments

Comment #0 by ivan.melnychuk+d — 2010-09-21T03:38:45Z
This is an issue similar to earlier reported and fixed for *struct* (see http://d.puremagic.com/issues/show_bug.cgi?id=2596). Using DMD v2.049 on Windows, the code for *struct* compiles whereas for *class* does not. If there is only *variadic* parameter - everything works, but as soon as other parameters are added before, the call to *ctor()* does not compile: struct S2 { // Good this(T...)(in string msg, T args) { } } class C1 { // Good this(T...)(T args) { } } class C2 { // Compiles, but ctor() fails this(T...)(in string msg, T args) { } } S2 s2 = S2(); // works auto c1 = new C1(); // works auto c2 = new C2("test"); // ERROR: does not compile with "Error: no constructor for C2"
Comment #1 by nfxjfg — 2010-09-21T04:59:11Z
It's a variadic template, not a variadic parameter. *** This issue has been marked as a duplicate of issue 435 ***