Bug 20733 – Documentation for hasElaborateAssign says copy construction creates an opAssign
Status
RESOLVED
Resolution
FIXED
Severity
trivial
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-04-13T14:23:53Z
Last change time
2020-04-13T16:54:36Z
Keywords
ddoc, pull
Assigned to
No Owner
Creator
Steven Schveighoffer
Comments
Comment #0 by schveiguy — 2020-04-13T14:23:53Z
Documentation for hasElaborateAssign says:
A type `S` gets compiler-generated `opAssign` in case it has
an elaborate copy constructor or elaborate destructor.
In fact, having an elaborate copy constructor does not generate an opAssign:
---
import std.stdio;
import std.traits;
struct S
{
this(ref const S other) { writeln("elaborate!"); }
}
void main()
{
S s;
writeln("copy construction:");
S s2 = s;
writeln("assignment:");
s = s2;
pragma(msg, __traits(allMembers, S));
pragma(msg, hasElaborateAssign!S);
}
----
output:
-- compile time output
tuple("__ctor")
false
-- runtime output
copy construction:
elaborate!
assignment:
---
No opAssign as a member, no elaborate assignment appears to be happening, and hasElaborateAssign is false.
The documentation should be changed.
Comment #1 by dlang-bot — 2020-04-13T15:47:18Z
@schveiguy updated dlang/phobos pull request #7443 "Fix 20733. Remove docs about copy construction from hasElaborateAssign." fixing this issue:
- Fix issue 20733. Remove docs about copy construction from hasElaborateAssign.
https://github.com/dlang/phobos/pull/7443
Comment #2 by dlang-bot — 2020-04-13T16:54:36Z
dlang/phobos pull request #7443 "Fix 20733. Remove docs about copy construction from hasElaborateAssign." was merged into master:
- 0d7bdb90fbd35640b3ec7936c4556ab4b067e218 by Steven Schveighoffer:
Fix issue 20733. Remove docs about copy construction from hasElaborateAssign.
https://github.com/dlang/phobos/pull/7443