[Issue 20695] Copy constructor disable default struct constructor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Mar 26 08:39:17 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=20695

--- Comment #5 from RazvanN <razvan.nitu1305 at gmail.com> ---
(In reply to Mathias LANG from comment #4)
> > It's always been the case that implementing opCall or a constructor disables struct literals and initializers
> 
> `opCall` does not disable literals. And it technically *hides* constructors,
> I'm sure there are some convoluted way to show it.
> 
> > This is not related to copy constructors: [...]
> 
> I'm well aware of the disappearance of default ctors in the presence of a
> single definition. While I would like for us to have a way to control it, a
> la "this() = default" (from C++), copy ctors are not *regular* ctors, and I
> don't think they should disable the default constructors.

Actually, copy constructors behave exactly as normal constructors, except that
they may be called implicitly in some situations.

--


More information about the Digitalmars-d-bugs mailing list