[Issue 8763] New: struct initialization with empty variadic arguments tries to call constructor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 5 03:29:03 PDT 2012


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

           Summary: struct initialization with empty variadic arguments
                    tries to call constructor
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: monarchdodra at gmail.com


--- Comment #0 from monarchdodra at gmail.com 2012-10-05 03:17:07 PDT ---
//----
struct S
{
    this(int);
}

void foo(T, Args...)(Args args)
{
    T t = T(args); Error: constructor main.S.this (int) is not callable using
argument types ()
}
void main()
{
    S t = S(); //OK, initialize to S.init
    foo!S();
}
//----
Basically, the compiler gets confused about "T(args)", and tries to call S's
constructor "this(int)".

Proper behavior would be to call "T()" and initialize to T.init

-- 
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