Bug 6938 – no implicit copy constructor for struct literal expression
Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
All
Creation time
2011-11-12T08:50:16Z
Last change time
2019-12-19T16:46:51Z
Assigned to
No Owner
Creator
Martin Nowak
Comments
Comment #0 by code — 2011-11-12T08:50:16Z
struct S
{
int a;
}
auto s1 = S();
S s2 = s1; // works
auto s3 = S(s1); // doesn't work, but should be equivalent to the above
------------
The compiler should rewrite that case to use copy constructor
and postblit.
Comment #1 by razvan.nitu1305 — 2019-12-19T16:46:51Z
This bug report is invalid. DMD does not have implicit constructors. Blits are made by default if a struct does not define a copy constructor; this behavior is according to the spec. Closing as invalid.