diff options
author | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-10 08:32:16 +0000 |
---|---|---|
committer | gdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-11-10 08:32:16 +0000 |
commit | b9fa4ee04735bea82e62873d474fd461bf0277df (patch) | |
tree | 438670b86a1e7bbfb313f955d4b0d7ff755576c5 /gcc/cp | |
parent | f299cc9c6d289528799696d2f9650a7fcf4384ae (diff) | |
download | gcc-b9fa4ee04735bea82e62873d474fd461bf0277df.tar.gz |
PR c++/12832
* name-lookup.c (supplement_binding): Gracefully handle names
used at non-class scope prior declaration.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@73406 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 11 |
2 files changed, 13 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7f83578b137..a8fedc86732 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-11-10 Gabriel Dos Reis <gdr@integrable-solutions.net> + + PR c++/12832 + * name-lookup.c (supplement_binding): Gracefully handle names + used at non-class scope prior declaration. + 2003-11-06 Matt Austern <austern@apple.com> * decl.c (duplicate_decls): copy DECL_VISIBILITY field. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index add0d55d405..624e86e24f1 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -435,10 +435,13 @@ supplement_binding (cxx_binding *binding, tree decl) if (TREE_CODE (decl) == TYPE_DECL && DECL_ARTIFICIAL (decl)) /* The new name is the type name. */ binding->type = decl; - else if (!bval) - /* This situation arises when push_class_level_binding moves an - inherited type-binding out of the way to make room for a new - value binding. */ + else if (!bval || bval == error_mark_node) + /* VALUE is null when push_class_level_binding moves an inherited + type-binding out of the way to make room for a new value binding. + It is an error_mark_node when DECL's name has been used in a + non-class scope prior declaration. In that case, we should have + already issued a diagnostic; for graceful error recovery purpose, + pretend this was the intended declaration for that name. */ binding->value = decl; else if (TREE_CODE (bval) == TYPE_DECL && DECL_ARTIFICIAL (bval)) { |