[Issue 23382] New: Non-template requirement for copy constructors is undocumented
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Oct 2 20:34:15 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23382
Issue ID: 23382
Summary: Non-template requirement for copy constructors is
undocumented
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dlang.org
Assignee: nobody at puremagic.com
Reporter: snarwin+bugzilla at gmail.com
Constructor templates are never considered to be copy constructors by the
compiler:
---
struct S
{
this()(ref S other) { assert(0); }
}
void main()
{
S original;
S copy = original; // no assert
}
---
However, this is not documented in the language spec's section on copy
constructors:
https://dlang.org/spec/struct.html#struct-copy-constructor
--
More information about the Digitalmars-d-bugs
mailing list