diff options
author | Nicholas Duffek <nsd@redhat.com> | 2000-07-09 05:16:11 +0000 |
---|---|---|
committer | Nicholas Duffek <nsd@redhat.com> | 2000-07-09 05:16:11 +0000 |
commit | 546022221a0ddf4216735c8a6428f76c962cfe89 (patch) | |
tree | 1534d2c292afa12ec7a2e5d2542eaf97cbcb1c74 /gdb/testsuite/gdb.c++/misc.cc | |
parent | 6b1ba9a0022b6608ddf28ac2eb04d665aa06135b (diff) | |
download | binutils-546022221a0ddf4216735c8a6428f76c962cfe89.zip binutils-546022221a0ddf4216735c8a6428f76c962cfe89.tar.gz binutils-546022221a0ddf4216735c8a6428f76c962cfe89.tar.bz2 |
* gdb.c++/misc.cc (class ClassParam, class_param): Define.
(use_methods): New function.
(main): Call use_methods().
* gdb.c++/classes.exp (test_method_param_class): New procedure.
(do_tests): Call test_method_param_class.
Diffstat (limited to 'gdb/testsuite/gdb.c++/misc.cc')
-rw-r--r-- | gdb/testsuite/gdb.c++/misc.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.c++/misc.cc b/gdb/testsuite/gdb.c++/misc.cc index e4c3520..caa5451 100644 --- a/gdb/testsuite/gdb.c++/misc.cc +++ b/gdb/testsuite/gdb.c++/misc.cc @@ -427,6 +427,18 @@ void enums1 () obj_with_enum.priv_enum = ClassWithEnum::green; } +class ClassParam { +public: + int Aptr_a (A *a) { return a->a; } + int Aptr_x (A *a) { return a->x; } + int Aref_a (A &a) { return a.a; } + int Aref_x (A &a) { return a.x; } + int Aval_a (A a) { return a.a; } + int Aval_x (A a) { return a.x; } +}; + +ClassParam class_param; + class Contains_static_instance { public: @@ -514,6 +526,18 @@ void dummy() v_bool_array[1] = v_bool; } +void use_methods () +{ + /* Refer to methods so that they don't get optimized away. */ + int i; + i = class_param.Aptr_a (&g_A); + i = class_param.Aptr_x (&g_A); + i = class_param.Aref_a (g_A); + i = class_param.Aref_x (g_A); + i = class_param.Aval_a (g_A); + i = class_param.Aval_x (g_A); +} + int main() @@ -536,6 +560,8 @@ main() /* Make sure the AIX linker doesn't remove the variable. */ v_tagless.one = 5; + use_methods (); + return foo.*pmi; } |