summaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-03-15 17:10:37 +0000
committerTom Tromey <tromey@redhat.com>2013-03-15 17:10:37 +0000
commit7a050675b6fa1e0bc4253f0aa9a932b7be30e642 (patch)
treea033076ad223f8364e4488df2923543c3bad9bb3 /gdb/gdbtypes.c
parent7b8b56ef08e29c9682d55d7ae7f0d9aa298c5c88 (diff)
downloadgdb-7a050675b6fa1e0bc4253f0aa9a932b7be30e642.tar.gz
PR c++/15116:
* gdbtypes.c (types_equal): Handle TYPE_CODE_FUNC. gdb/testsuite * gdb.cp/overload.cc (intintfunc): New. * gdb.cp/overload.exp: Add regression test.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 12730d7b12b..a1c4018e69d 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2456,6 +2456,25 @@ types_equal (struct type *a, struct type *b)
if (a == b)
return 1;
+ /* Two function types are equal if their argument and return types
+ are equal. */
+ if (TYPE_CODE (a) == TYPE_CODE_FUNC)
+ {
+ int i;
+
+ if (TYPE_NFIELDS (a) != TYPE_NFIELDS (b))
+ return 0;
+
+ if (!types_equal (TYPE_TARGET_TYPE (a), TYPE_TARGET_TYPE (b)))
+ return 0;
+
+ for (i = 0; i < TYPE_NFIELDS (a); ++i)
+ if (!types_equal (TYPE_FIELD_TYPE (a, i), TYPE_FIELD_TYPE (b, i)))
+ return 0;
+
+ return 1;
+ }
+
return 0;
}