[Issue 10372] Document NRVO is applied in simple cases

2022-12-17 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10372

Iain Buclaw  changed:

   What|Removed |Added

   Priority|P2  |P3

--


[Issue 10372] Document NRVO is applied in simple cases

2013-11-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=10372



--- Comment #2 from Denis Shelomovskij  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: ---


[Issue 10372] Document NRVO is applied in simple cases

2013-11-05 Thread d-bugmail
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: ---