https://d.puremagic.com/issues/show_bug.cgi?id=10372
Lars T. Kyllingstad changed:
What|Removed |Added
CC||bugzi...@kyllingen.net
--- Comment #1 from Lars T. Kyllingstad 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: ---