diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/temporary1.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/temporary1.C | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/temporary1.C b/gcc/testsuite/g++.old-deja/g++.other/temporary1.C deleted file mode 100644 index 93cd7097783..00000000000 --- a/gcc/testsuite/g++.old-deja/g++.other/temporary1.C +++ /dev/null @@ -1,40 +0,0 @@ -extern "C" int printf(char*, ...); - -int c, d; -class Foo -{ -public: - Foo() { printf("Foo() 0x%08lx\n", (unsigned long)this); ++c; } - Foo(Foo const &) { printf("Foo(Foo const &) 0x%08lx\n", (unsigned long)this); } - ~Foo() { printf("~Foo() 0x%08lx\n", (unsigned long)this); ++d; } -}; - -// Bar creates constructs a temporary Foo() as a default -class Bar -{ -public: - Bar(Foo const & = Foo()) { printf("Bar(Foo const &) 0x%08lx\n", (unsigned long)this); } -}; - -void fakeRef(Bar *) -{ -} - -int main() -{ - // Create array of Bar. Will use default argument on constructor. - // The old compiler will loop constructing Bar. Each loop will - // construct a temporary Foo() but will not destruct the Foo(). - // The Foo() temporary is destructed only once after the loop - // completes. This could lead to a memory leak if the constructor - // of Foo() allocates memory. - Bar bar[2]; - - fakeRef(bar); - - printf("Done\n"); - - if (c == d && c == 2) - return 0; - return 1; -} |