diff options
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r-- | gdb/c-exp.y | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 5d4cd81..03af9e7 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -2960,13 +2960,39 @@ classify_inner_name (const struct block *block, struct type *context) copy = copy_name (yylval.ssym.stoken); yylval.ssym.sym = cp_lookup_nested_symbol (type, copy, block); + + /* If no symbol was found, search for a matching base class named + COPY. This will allow users to enter qualified names of class members + relative to the `this' pointer. */ if (yylval.ssym.sym == NULL) - return ERROR; + { + struct type *base_type = find_type_baseclass_by_name (type, copy); + + if (base_type != NULL) + { + yylval.tsym.type = base_type; + return TYPENAME; + } + + return ERROR; + } switch (SYMBOL_CLASS (yylval.ssym.sym)) { case LOC_BLOCK: case LOC_LABEL: + /* cp_lookup_nested_symbol might have accidentally found a constructor + named COPY when we really wanted a base class of the same name. + Double-check this case by looking for a base class. */ + { + struct type *base_type = find_type_baseclass_by_name (type, copy); + + if (base_type != NULL) + { + yylval.tsym.type = base_type; + return TYPENAME; + } + } return ERROR; case LOC_TYPEDEF: |