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: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Kenji Hara <[email protected]> 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: -------