[Issue 17457] New: Named Return Value Optimization (NRVO) not done with return of constructor call

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed May 31 00:50:21 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17457

          Issue ID: 17457
           Summary: Named Return Value Optimization (NRVO) not done with
                    return of constructor call
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

NRVO is not done for:

  struct S {
    ulong[10] x; // ensure stack placement instead of register placement
    this(int i);
  }

  S foo() {
    return S(10);
  }

but is done for:

  S foo() {
    auto s = S(10);
    return s;
  }

--


More information about the Digitalmars-d-bugs mailing list