digitalmars.D.bugs - [Issue 23382] New: Non-template requirement for copy constructors is
- d-bugmail puremagic.com (31/31) Oct 02 2022 https://issues.dlang.org/show_bug.cgi?id=23382
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 puremagic.com Reporter: snarwin+bugzilla 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 --
Oct 02 2022