diff options
author | Tom Tromey <tromey@redhat.com> | 2010-02-08 20:55:43 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2010-02-08 20:55:43 +0000 |
commit | 714f19d5576e314d5b9c3b674b11bf4212a3faeb (patch) | |
tree | 6b850af87174bbcde740d2a842519fe41cd4436c /gdb/testsuite/gdb.cp | |
parent | d0c9aeb3fc18f9f77a8e173b1fb9616931f669bd (diff) | |
download | binutils-714f19d5576e314d5b9c3b674b11bf4212a3faeb.zip binutils-714f19d5576e314d5b9c3b674b11bf4212a3faeb.tar.gz binutils-714f19d5576e314d5b9c3b674b11bf4212a3faeb.tar.bz2 |
gdb
PR c++/8017:
* value.h: Update.
* valops.c (search_struct_field): Make 'name' const.
(search_struct_method): Likewise.
(find_method_list): Make 'method' const.
(value_struct_elt): Make 'name' and 'err' const.
(value_find_oload_method_list): Make 'method' const.
(find_overload_match): Make 'name' const.
* eval.c (evaluate_subexp_standard): New locals function,
function_name.
<OP_FUNCALL>: Handle OP_SCOPE specially.
gdb/testsuite
PR c++/8017:
* gdb.cp/overload.exp: Add tests.
* gdb.cp/overload.cc (struct K): New.
(namespace N): New.
(main): Call new functions.
(K::staticoverload): Define.
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r-- | gdb/testsuite/gdb.cp/overload.cc | 22 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/overload.exp | 10 |
2 files changed, 32 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.cp/overload.cc b/gdb/testsuite/gdb.cp/overload.cc index 64c2090..e643d4c 100644 --- a/gdb/testsuite/gdb.cp/overload.cc +++ b/gdb/testsuite/gdb.cp/overload.cc @@ -42,7 +42,18 @@ int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9, int a10, int a11); +}; + +struct K { + static int staticoverload (); + static int staticoverload (int); + static int staticoverload (int, int); +}; +namespace N { + int nsoverload () { return 1; } + int nsoverload (int x) { return x; } + int nsoverload (int x, int y) { return x + y; } }; int intToChar (char c) @@ -97,6 +108,14 @@ int main () foo foo_instance2(222, str); foo foo_instance3(foo_instance2); + // Some calls to ensure all the functions are emitted. + K::staticoverload(); + K::staticoverload(2); + K::staticoverload(2, 3); + N::nsoverload(); + N::nsoverload(2); + N::nsoverload(2, 3); + #ifdef usestubs set_debug_traps(); breakpoint(); @@ -196,3 +215,6 @@ int foo::overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7, +int K::staticoverload () { return 1; } +int K::staticoverload (int x) { return x; } +int K::staticoverload (int x, int y) { return x + y; } diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp index 1bfa0f3..317cbc5 100644 --- a/gdb/testsuite/gdb.cp/overload.exp +++ b/gdb/testsuite/gdb.cp/overload.exp @@ -299,6 +299,16 @@ gdb_test "print overloadNamespace(1)" ".\[0-9\]* = 1" gdb_test "print overloadNamespace('a')" ".\[0-9\]* = 1" gdb_test "print overloadNamespace(dummyInstance)" ".\[0-9\]* = 2" +# Static methods. +gdb_test "print K::staticoverload ()" " = 1" +gdb_test "print K::staticoverload (2)" " = 2" +gdb_test "print K::staticoverload (2, 3)" " = 5" + +# Namespace-qualified functions. +gdb_test "print N::nsoverload ()" " = 1" +gdb_test "print N::nsoverload (2)" " = 2" +gdb_test "print N::nsoverload (2, 3)" " = 5" + if ![runto 'XXX::marker2'] then { perror "couldn't run to XXX::marker2" continue |