Bug 8763 – struct initialization with empty variadic arguments tries to call constructor
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-10-05T03:17:00Z
Last change time
2014-02-12T03:27:40Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
monarchdodra
Comments
Comment #0 by monarchdodra — 2012-10-05T03:17:07Z
//----
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
Comment #1 by github-bugzilla — 2013-02-07T05:14:57Z