2 extern "C" int printf (const char *, ...);
8 Foo() { printf("Foo() 0x%08lx\n", (__SIZE_TYPE__)this); ++c; }
9 Foo(Foo const &) { printf("Foo(Foo const &) 0x%08lx\n", (__SIZE_TYPE__)this); }
10 ~Foo() { printf("~Foo() 0x%08lx\n", (__SIZE_TYPE__)this); ++d; }
13 // Bar creates constructs a temporary Foo() as a default
17 Bar(Foo const & = Foo()) { printf("Bar(Foo const &) 0x%08lx\n", (__SIZE_TYPE__)this); }
26 // Create array of Bar. Will use default argument on constructor.
27 // The old compiler will loop constructing Bar. Each loop will
28 // construct a temporary Foo() but will not destruct the Foo().
29 // The Foo() temporary is destructed only once after the loop
30 // completes. This could lead to a memory leak if the constructor
31 // of Foo() allocates memory.