diff options
Diffstat (limited to 'gdb/testsuite/gdb.cp/rtti1.cc')
-rw-r--r-- | gdb/testsuite/gdb.cp/rtti1.cc | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.cp/rtti1.cc b/gdb/testsuite/gdb.cp/rtti1.cc index 6e9d862bb13..de8e12fc8e4 100644 --- a/gdb/testsuite/gdb.cp/rtti1.cc +++ b/gdb/testsuite/gdb.cp/rtti1.cc @@ -1,6 +1,6 @@ /* Code to go along with tests in rtti.exp. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004 Free Software Foundation, Inc. Contributed by David Carlton <carlton@bactrian.org> and by Kealia, Inc. @@ -55,6 +55,26 @@ namespace n1 { } // n1 +// NOTE: carlton/2004-01-23: This call exists only to convince GCC to +// keep around a reference to 'obj' in n2::func - GCC 3.4 had been +// optimizing it away. +void refer_to (n2::C2 *obj) +{ + // Do nothing. +} + +namespace n2 +{ + void func () + { + C2 *obj = create2 (); + + refer_to (obj); // func-constructs-done + + return; + } +} + int main() { using namespace n1; @@ -63,5 +83,7 @@ int main() C1 *e1 = create1(); C2 *e2 = create2(); - return 0; // constructs-done + n2::func(); // main-constructs-done + + return 0; } |