October 16, 2020
https://issues.dlang.org/show_bug.cgi?id=21316

          Issue ID: 21316
           Summary: NRVO not triggered for rvalue/ctor call
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/
                OS: All
            Status: NEW
          Severity: major
          Priority: P3
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: eyal@weka.io

Example program:

  import std.stdio;

  struct S {
      this(int x) { writefln("%s", &this); }
      ~this() { writefln("%s", &this); }
  }

  unittest {
      auto f() { return S(1); }
      auto x = f();
  }

Running results in 2 different this ptrs, showing a copy had occurred:

  dmd -unittest -main -run testnrvo
  7FFE98EAAD20
  7FFE98EAAD48

--