aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2011-03-29 17:04:31 +0000
committerTom Tromey <tromey@redhat.com>2011-03-29 17:04:31 +0000
commit53832f31471912a20ce0a1d0182ecd0633b3f1ec (patch)
tree94610986f187b4f7958e65b6ca2d4fab5100722a /gdb/valops.c
parent09b587083c5b3e18b5b9b86ba7b4cf9839658d0d (diff)
downloadgdb-53832f31471912a20ce0a1d0182ecd0633b3f1ec.zip
gdb-53832f31471912a20ce0a1d0182ecd0633b3f1ec.tar.gz
gdb-53832f31471912a20ce0a1d0182ecd0633b3f1ec.tar.bz2
gdb
* dwarf2read.c (fixup_partial_die): Handle linkage name on otherwise anonymous types. (dwarf2_name): Likewise. * valops.c (value_struct_elt_for_reference): Refine artificial type logic. Call error if j==-1. gdb/testsuite * gdb.cp/anon-struct.cc: New file. * gdb.cp/anon-struct.exp: New file.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index b9f5508..99115b7 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -3339,25 +3339,32 @@ value_struct_elt_for_reference (struct type *domain, int offset,
int ii;
j = -1;
- for (ii = 0; ii < TYPE_FN_FIELDLIST_LENGTH (t, i);
- ++ii)
+ for (ii = 0; ii < len; ++ii)
{
/* Skip artificial methods. This is necessary if,
for example, the user wants to "print
subclass::subclass" with only one user-defined
- constructor. There is no ambiguity in this
- case. */
+ constructor. There is no ambiguity in this case.
+ We are careful here to allow artificial methods
+ if they are the unique result. */
if (TYPE_FN_FIELD_ARTIFICIAL (f, ii))
- continue;
+ {
+ if (j == -1)
+ j = ii;
+ continue;
+ }
/* Desired method is ambiguous if more than one
method is defined. */
- if (j != -1)
+ if (j != -1 && !TYPE_FN_FIELD_ARTIFICIAL (f, j))
error (_("non-unique member `%s' requires "
"type instantiation"), name);
j = ii;
}
+
+ if (j == -1)
+ error (_("no matching member function"));
}
if (TYPE_FN_FIELD_STATIC_P (f, j))