diff options
author | Sami Wagiaalla <swagiaal@redhat.com> | 2010-11-04 20:43:25 +0000 |
---|---|---|
committer | Sami Wagiaalla <swagiaal@redhat.com> | 2010-11-04 20:43:25 +0000 |
commit | a9d5ef47f3a97fed25e4a5a507b2607e1adc629a (patch) | |
tree | c3e78f94bc101d9e7b62508d356f7b56241bb0ba /gdb/testsuite | |
parent | 6403aeeaa1ebe388c0fc518f02569f9323a79981 (diff) | |
download | gdb-a9d5ef47f3a97fed25e4a5a507b2607e1adc629a.zip gdb-a9d5ef47f3a97fed25e4a5a507b2607e1adc629a.tar.gz gdb-a9d5ef47f3a97fed25e4a5a507b2607e1adc629a.tar.bz2 |
Fix derived class overload problem.
2010-11-04 Sami Wagiaalla <swagiaal@redhat.com>
* gdbtypes.h (struct rank): Created subrank.
* gdbtypes.c: Initialized subrank for all
'BADNESS' constants.
(distance_to_ancestor): New function.
(is_ancestor): Use distance_to_ancestor.
(is_public_ancestor): Ditto.
(sum_ranks): Handle subrank.
(compare_ranks): Ditto.
(rank_one_type): Subrank base conversions.
2010-11-04 Sami Wagiaalla <swagiaal@redhat.com>
* gdb.cp/overload.exp: Added test for inheritance
overload.
* gdb.cp/overload.cc: Ditto.
* gdb.cp/oranking.exp: Removed releveant kfails.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/oranking.exp | 3 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/overload.cc | 18 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/overload.exp | 5 |
4 files changed, 29 insertions, 3 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 914d044..d68e850 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2010-11-04 Sami Wagiaalla <swagiaal@redhat.com> + + * gdb.cp/overload.exp: Added test for inheritance overload. + * gdb.cp/overload.cc: Ditto. + * gdb.cp/oranking.exp: Removed releveant kfails. + 2010-11-04 Jan Kratochvil <jan.kratochvil@redhat.com> Joel Brobecker <brobecker@adacore.com> diff --git a/gdb/testsuite/gdb.cp/oranking.exp b/gdb/testsuite/gdb.cp/oranking.exp index f1efb77..9c4e9dc 100644 --- a/gdb/testsuite/gdb.cp/oranking.exp +++ b/gdb/testsuite/gdb.cp/oranking.exp @@ -58,15 +58,12 @@ gdb_test "p test6()" "28" gdb_test "p foo6(bp)" "28" gdb_test "p test7()" "210" -setup_kfail "gdb/10343" *-*-* gdb_test "p foo7(cp)" "210" gdb_test "p test8()" "212" -setup_kfail "gdb/10343" *-*-* gdb_test "p foo8(co)" "212" gdb_test "p test9()" "214" -setup_kfail "gdb/12098" *-*-* gdb_test "p foo9(co)" "214" gdb_test "p test10()" "216" diff --git a/gdb/testsuite/gdb.cp/overload.cc b/gdb/testsuite/gdb.cp/overload.cc index dc117fb..bd2f96c 100644 --- a/gdb/testsuite/gdb.cp/overload.cc +++ b/gdb/testsuite/gdb.cp/overload.cc @@ -89,6 +89,14 @@ namespace XXX { void marker2() {} } +class A {}; +class B: public A {}; +class C: public B {}; +class D: C {}; + +int bar (A) { return 11; } +int bar (B) { return 22; } + int main () { char arg2 = 2; @@ -105,6 +113,15 @@ int main () int arg13 = 200.0; char arg14 = 'a'; + A a; + B b; + C c; + D d; + + bar (a); + bar (b); + bar (c); + char *str = (char *) "A"; foo foo_instance1(111); foo foo_instance2(222, str); @@ -132,6 +149,7 @@ int main () marker1(); // marker1-returns-here XXX::marker2(); // marker1-returns-here + return 0; } diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp index 25aeb07..05ca315 100644 --- a/gdb/testsuite/gdb.cp/overload.exp +++ b/gdb/testsuite/gdb.cp/overload.exp @@ -266,6 +266,11 @@ gdb_test "print foo_instance1.overload1arg(&arg14)" \ "\\$\[0-9\]+ = 14" \ "print call overloaded func char\\* arg" +gdb_test "print bar(a)" "= 11" +gdb_test "print bar(b)" "= 22" +gdb_test "print bar(c)" "= 22" +gdb_test "print bar(d)" "= 22" + # --- # List overloaded functions. |