diff options
author | Keith Seitz <keiths@redhat.com> | 2013-11-25 13:37:08 -0800 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2013-11-25 13:37:08 -0800 |
commit | f7e3ecae9ff55b69aab93af61a7f7ca272d03d0a (patch) | |
tree | 8b09679efbdab89ae85dbbb6a03d9890ff0433c2 /gdb/c-exp.y | |
parent | b02677b9040a23788b4e07c7cfbf75eca0aa2775 (diff) | |
download | gdb-f7e3ecae9ff55b69aab93af61a7f7ca272d03d0a.zip gdb-f7e3ecae9ff55b69aab93af61a7f7ca272d03d0a.tar.gz gdb-f7e3ecae9ff55b69aab93af61a7f7ca272d03d0a.tar.bz2 |
PR c++/14819: Explicit class:: inside class scope does not work
https://sourceware.org/ml/gdb-patches/2013-11/msg00102.html
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: |