Bug 8115 – Templated default constructor not called
Status
RESOLVED
Resolution
INVALID
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-18T15:28:03Z
Last change time
2022-12-01T13:33:48Z
Assigned to
No Owner
Creator
dlang+issues
Comments
Comment #0 by dlang+issues — 2012-05-18T15:28:03Z
struct S { this(A...)(A) { static assert(0, "It compiles?!"); } }
void main() { auto s = S(); }
Comment #1 by crimaniak — 2017-03-19T22:01:16Z
templated constructor this(A...)(A) is not matched for empty argument list, for both structs and classes, tested on DMD64 D Compiler v2.073.0
Comment #2 by razvan.nitu1305 — 2022-12-01T13:33:48Z
Default constructors are not allowed for structs, therefore the templated one is only going to get matched once you provide at least one argument. This is the correct behavior.