www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4905] New: Variadic constructors don't compile for classes

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: ivan.melnychuk+d gmail.com


--- Comment #0 from vano <ivan.melnychuk+d 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: -------
Sep 21 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4905


nfxjfg gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |nfxjfg gmail.com
         Resolution|                            |DUPLICATE


--- Comment #1 from nfxjfg gmail.com 2010-09-21 04:59:11 PDT ---
It's a variadic template, not a variadic parameter.

*** This issue has been marked as a duplicate of issue 435 ***

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