[Issue 4905] New: Variadic constructors don't compile for classes

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 21 03:39:25 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4905

           Summary: Variadic constructors don't compile for classes
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: ivan.melnychuk+d at gmail.com


--- Comment #0 from vano <ivan.melnychuk+d at gmail.com> 2010-09-21 03:38:45 PDT ---
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"

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


More information about the Digitalmars-d-bugs mailing list