October 02, 2022 [Issue 23382] New: Non-template requirement for copy constructors is undocumented | ||||
|---|---|---|---|---|
| ||||
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 -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply