aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>1998-05-09 14:10:28 -0400
committerJason Merrill <jason@gcc.gnu.org>1998-05-09 14:10:28 -0400
commitb9082e8adb8a8e2c6501350ae1c7a5e189a9995c (patch)
treefffe277ae140f32c34ad7fd9c26c341e4080c3cc /gcc/cp/decl.c
parent6e940d05f48d784783f1a8ce79bba3a47a2263a2 (diff)
downloadgcc-b9082e8adb8a8e2c6501350ae1c7a5e189a9995c.zip
gcc-b9082e8adb8a8e2c6501350ae1c7a5e189a9995c.tar.gz
gcc-b9082e8adb8a8e2c6501350ae1c7a5e189a9995c.tar.bz2
class.c (currently_open_class): New fn.
* class.c (currently_open_class): New fn. * decl.c (lookup_name_real): Use it. * search.c (lookup_field): Likewise. From-SVN: r19650
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c73bea1..d0afbc2 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4826,20 +4826,21 @@ lookup_name_real (name, prefer_type, nonclass)
TYPE_DECLs. */
classval = lookup_field (current_class_type, name, 0, 1);
- /* yylex() calls this with -2, since we should never start digging for
- the nested name at the point where we haven't even, for example,
- created the COMPONENT_REF or anything like that. */
- if (classval == NULL_TREE)
- classval = lookup_nested_field (name, ! yylex);
-
/* Add implicit 'typename' to types from template bases. lookup_field
- will do this for us. */
+ will do this for us. If classval is actually from an enclosing
+ scope, lookup_nested_field will get it for us. */
if (processing_template_decl
&& classval && TREE_CODE (classval) == TYPE_DECL
- && DECL_CONTEXT (classval) != current_class_type
+ && ! currently_open_class (DECL_CONTEXT (classval))
&& uses_template_parms (current_class_type)
&& ! DECL_ARTIFICIAL (classval))
classval = lookup_field (current_class_type, name, 0, 1);
+
+ /* yylex() calls this with -2, since we should never start digging for
+ the nested name at the point where we haven't even, for example,
+ created the COMPONENT_REF or anything like that. */
+ if (classval == NULL_TREE)
+ classval = lookup_nested_field (name, ! yylex);
}
if (locval && classval)