[Assorted-commits] SF.net SVN: assorted:[1086] sandbox/trunk/src/cc/copies.cc
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-12-03 07:19:19
|
Revision: 1086 http://assorted.svn.sourceforge.net/assorted/?rev=1086&view=rev Author: yangzhang Date: 2008-12-03 07:19:15 +0000 (Wed, 03 Dec 2008) Log Message: ----------- publishing for blog post! Modified Paths: -------------- sandbox/trunk/src/cc/copies.cc Modified: sandbox/trunk/src/cc/copies.cc =================================================================== --- sandbox/trunk/src/cc/copies.cc 2008-12-03 06:28:53 UTC (rev 1085) +++ sandbox/trunk/src/cc/copies.cc 2008-12-03 07:19:15 UTC (rev 1086) @@ -20,6 +20,7 @@ A h() { return A(); } void i(A a) { a.x = 1; } A j(A a) { cout << "j()" << endl; return a; } +A k() { A a; f(a); return a; } int main() { // A() is called once as expected. @@ -152,5 +153,22 @@ // ~A() this=0x7fff386527c0 // ~A() this=0x7fff386527d0 + // Sanity-check: k() should behave the same as g(). + { + A a = k(); + } + cout << endl; + // Prints: + // A() this=0x7fff17102280 + // ~A() this=0x7fff17102280 + // + // With -fno-elide-constructors: + // A() this=0x7fff85c43d30 + // A(A) this=0x7fff85c43d70 + // ~A() this=0x7fff85c43d30 + // A(A) this=0x7fff85c43d80 + // ~A() this=0x7fff85c43d70 + // ~A() this=0x7fff85c43d80 + return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |