Bug 23382 – Non-template requirement for copy constructors is undocumented
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dlang.org
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-10-02T20:34:15Z
Last change time
2022-10-27T18:54:54Z
Keywords
pull
Assigned to
No Owner
Creator
Paul Backus
Comments
Comment #0 by snarwin+bugzilla — 2022-10-02T20:34:15Z
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
Comment #1 by snarwin+bugzilla — 2022-10-02T21:15:34Z
@pbackus updated dlang/dlang.org pull request #3427 "Clarify requirements for struct copy constructors" fixing this issue:
- Clarify requirements for struct copy constructors
This change replaces informal language with official terms, adds
cross-references, and documents a previously-undocumented requirement.
Fixes Issue 23382 - Non-template requirement for copy constructors is
undocumented
https://github.com/dlang/dlang.org/pull/3427
Comment #3 by dlang-bot — 2022-10-27T18:54:54Z
dlang/dlang.org pull request #3427 "Clarify requirements for struct copy constructors" was merged into master:
- 74b3a82ed02a41902865178a193c0b390b42d3b2 by Paul Backus:
Clarify requirements for struct copy constructors
This change replaces informal language with official terms, adds
cross-references, and documents a previously-undocumented requirement.
Fixes Issue 23382 - Non-template requirement for copy constructors is
undocumented
https://github.com/dlang/dlang.org/pull/3427