aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp/class2.cc
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2004-02-26 20:22:44 +0000
committerJoel Brobecker <brobecker@gnat.com>2004-02-26 20:22:44 +0000
commit98f9cd2d31788e025ca3e07f4fce5c09c68f2801 (patch)
treefc4761e9174d4b4ddc6f5f34b8016e56227781a8 /gdb/testsuite/gdb.cp/class2.cc
parent9b50c11b36020a71b97e57d4ff10a4d45855967a (diff)
downloadgdb-98f9cd2d31788e025ca3e07f4fce5c09c68f2801.zip
gdb-98f9cd2d31788e025ca3e07f4fce5c09c68f2801.tar.gz
gdb-98f9cd2d31788e025ca3e07f4fce5c09c68f2801.tar.bz2
* gdb.cp/class2.cc (empty): New class.
(refer): New function. (main): Declare an object of type empty and use it. * gdb.cp/class2.exp: Print the value of an object of type empty.
Diffstat (limited to 'gdb/testsuite/gdb.cp/class2.cc')
-rw-r--r--gdb/testsuite/gdb.cp/class2.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/class2.cc b/gdb/testsuite/gdb.cp/class2.cc
index 34263c8..b4aa20a 100644
--- a/gdb/testsuite/gdb.cp/class2.cc
+++ b/gdb/testsuite/gdb.cp/class2.cc
@@ -48,10 +48,19 @@ void refer (A *)
;
}
+struct empty {};
+
+// Stop the compiler from optimizing away data.
+void refer (empty *)
+{
+ ;
+}
+
int main (void)
{
A alpha, *aap, *abp;
B beta, *bbp;
+ empty e;
alpha.a1 = 100;
beta.a1 = 200; beta.b1 = 201; beta.b2 = 202;
@@ -59,6 +68,7 @@ int main (void)
aap = &alpha; refer (aap);
abp = &beta; refer (abp);
bbp = &beta; refer (bbp);
+ refer (&e);
return 0; // marker return 0
} // marker close brace