(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.
+2004-02-26 J. Brobecker <brobecker@gnat.com>
+
+ * 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.
+
2004-02-26 Jeff Johnston <jjohnstn@redhat.com>
* gdb.base/langs.exp: Update query string to match the
;
}
+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;
aap = α refer (aap);
abp = β refer (abp);
bbp = β refer (bbp);
+ refer (&e);
return 0; // marker return 0
} // marker close brace
-# Copyright 2003 Free Software Foundation, Inc.
+# Copyright 2003, 2004 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
gdb_test "print * (B *) abp" \
"= {.*a1 = 200.*b1 = 201.*b2 = 202}" \
"print * (B *) abp at marker return 0"
+
+# Printing the value of an object containing no data fields:
+
+gdb_test "p e" "= \{<No data fields>\}" "print object with no data fields"