[Issue 11287] New: NRVO should remove dtor call completely

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 17 02:02:30 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11287

           Summary: NRVO should remove dtor call completely
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-10-17 02:02:16 PDT ---
This is similar to bug 11286, but slightly different.

Test case:

struct A
{
    ~this() {}
}

A getA() pure
{
    A a;        // line 7
    return a;   // NRVO
}

void main()
{
    A a = getA();
}

Output:

test.d(7): Error: pure function 'test.getA' cannot call impure function
'test.A.~this'

In the function getA(), the variable 'a' will be moved out to the caller by
NRVO, and its dtor won't be called. So compiler should accept the case
properly.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list