[Issue 10372] Document NRVO is applied in simple cases
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 5 10:31:23 PST 2013
https://d.puremagic.com/issues/show_bug.cgi?id=10372
Lars T. Kyllingstad <bugzilla at kyllingen.net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugzilla at kyllingen.net
--- Comment #1 from Lars T. Kyllingstad <bugzilla at 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: -------
More information about the Digitalmars-d-bugs
mailing list