November 05, 2013 [Issue 10372] Document NRVO is applied in simple cases | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=10372 Lars T. Kyllingstad <bugzilla@kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@kyllingen.net --- Comment #1 from Lars T. Kyllingstad <bugzilla@kyllingen.net> 2013-11-05 10:31:21 PST --- Even for cases where NRVO can't be applied, the spec should guarantee that the returned struct is moved and not copied. As far as I can tell, move-on-return can be applied whenever a struct is created on the stack and then returned. Here's an example of a case where NRVO can't necessarily be applied, but which should still compile: struct S { @disable this(this); } S makeS(bool b) { S s1; S s2; return b ? s1 : s2; } void main() { auto s = makeS(true); } Note that this compiles today, it just needs to be documented in the spec. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
November 05, 2013 [Issue 10372] Document NRVO is applied in simple cases | ||||
---|---|---|---|---|
| ||||
https://d.puremagic.com/issues/show_bug.cgi?id=10372 --- Comment #2 from Denis Shelomovskij <verylonglogin.reg@gmail.com> 2013-11-05 22:49:44 MSK --- (In reply to comment #1) > ... > auto s = makeS(true); Only `makeS` is related to this issue. This code is for Issue 10371. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation