May 11, 2012 [Issue 7130] NRVO Bug: Wrong Code With D'tor + Conditional Return | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=7130 Kenji Hara <k.hara.pg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2012-05-10 23:05:16 PDT --- (In reply to comment #0) > Both D'tors are called and the returned result lives at a different address after being returned than before, as expected if not using NRVO. On the other hand, no postblit being called for whichever struct is returned, as expected if using NRVO. The function 'doit' cannot NRVO, because &s1 and &s2 should have different addresses. S doIt(int i) { S s1; S s2; printf("s1 lives at %p.\n", &s1); printf("s2 lives at %p.\n", &s2); return (i == 42) ? s1 : s2; // postblit should run } I'll make this a dup of bug 7516. I have posted more better test code in there. *** This issue has been marked as a duplicate of issue 7516 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation