From b9082e8adb8a8e2c6501350ae1c7a5e189a9995c Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sat, 9 May 1998 14:10:28 -0400 Subject: 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 --- gcc/cp/decl.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'gcc/cp/decl.c') 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) -- cgit v1.1