aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-12-14 21:19:11 +0000
committerTom Tromey <tromey@redhat.com>2012-12-14 21:19:11 +0000
commit6592e36f33270932ce9f9d19fd6488b3754c1b95 (patch)
tree8ad41b5bae9054ee31a7ce0404c5ab74a0d46577 /gdb/c-exp.y
parent7d27a96df4e297e7329e0e3856c6d6e346478c80 (diff)
downloadfsf-binutils-gdb-6592e36f33270932ce9f9d19fd6488b3754c1b95.zip
fsf-binutils-gdb-6592e36f33270932ce9f9d19fd6488b3754c1b95.tar.gz
fsf-binutils-gdb-6592e36f33270932ce9f9d19fd6488b3754c1b95.tar.bz2
PR c++/8888:
* symtab.c (lookup_symbol_aux): If constructor is found, consider returning the type instead. * c-exp.y (classify_name): Check STRUCT_DOMAIN if a constructor is found. testsuite * gdb.cp/member-name.exp: New file. * gdb.cp/member-name.cc: New file.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r--gdb/c-exp.y21
1 files changed, 21 insertions, 0 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 2c6eeda..fe5ddf8 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -55,6 +55,7 @@
#include "macroscope.h"
#include "objc-lang.h"
#include "typeprint.h"
+#include "cp-abi.h"
#define parse_type builtin_type (parse_gdbarch)
@@ -2780,6 +2781,26 @@ classify_name (const struct block *block)
yylval.bval = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), STATIC_BLOCK);
return FILENAME;
}
+
+ /* If we found a field of 'this', we might have erroneously
+ found a constructor where we wanted a type name. Handle this
+ case by noticing that we found a constructor and then look up
+ the type tag instead. */
+ if (is_a_field_of_this.type != NULL
+ && is_a_field_of_this.fn_field != NULL
+ && TYPE_FN_FIELD_CONSTRUCTOR (is_a_field_of_this.fn_field->fn_fields,
+ 0))
+ {
+ struct field_of_this_result inner_is_a_field_of_this;
+
+ sym = lookup_symbol (copy, block, STRUCT_DOMAIN,
+ &inner_is_a_field_of_this);
+ if (sym != NULL)
+ {
+ yylval.tsym.type = SYMBOL_TYPE (sym);
+ return TYPENAME;
+ }
+ }
}
if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)