aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.cp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.cp')
-rw-r--r--gdb/testsuite/gdb.cp/overload.cc22
-rw-r--r--gdb/testsuite/gdb.cp/overload.exp10
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