[Issue 15869] RVO can overwrite argument
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Apr 22 05:47:58 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=15869
--- Comment #12 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to Walter Bright from comment #9)
> The most pragmatic solution is to not allow taking a reference to an
> unconstructed field.
That proved unworkable.
One that does work is to regard taking the address of a field as "initializing"
it. Then,
a = clobber(&a);
is regarded as an assignment, rather than a construction, and the RVO is set to
a temporary, not `a`.
Nothing else I could think of was palatable.
--
More information about the Digitalmars-d-bugs
mailing list