www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17457] New: Named Return Value Optimization (NRVO) not done

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 puremagic.com
          Reporter: bugzilla 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;
  }

--
May 31