D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6938 - no implicit copy constructor for struct literal expression
Summary: no implicit copy constructor for struct literal expression
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-12 08:50 UTC by Martin Nowak
Modified: 2019-12-19 16:46 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2011-11-12 08:50:16 UTC
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 RazvanN 2019-12-19 16:46:51 UTC
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.