From d0b4bf064cc775c510f804bee8394067530cc2bb Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 31 Aug 2012 02:50:18 +0000 Subject: [PATCH] * semantics.c (finish_qualified_id_expr): Handle building up a non-dependent SCOPE_REF here. (finish_id_expression): Not here. * error.c (dump_decl) [SCOPE_REF]: Only pass TFF_UNQUALIFIED_NAME. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190829 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/error.c | 2 +- gcc/cp/semantics.c | 35 +++++++++++++++++++---------------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fc49329ed0d..c202dc4f027 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2012-08-30 Jason Merrill + * semantics.c (finish_qualified_id_expr): Handle building up a + non-dependent SCOPE_REF here. + (finish_id_expression): Not here. + * error.c (dump_decl) [SCOPE_REF]: Only pass TFF_UNQUALIFIED_NAME. + * friend.c (make_friend_class): Handle template template parameters. * parser.c (cp_parser_template_declaration_after_export): Likewise. * pt.c (tsubst_friend_class): Likewise. diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 40f96d33f9b..7d60fe00c18 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1042,7 +1042,7 @@ dump_decl (tree t, int flags) case SCOPE_REF: dump_type (TREE_OPERAND (t, 0), flags); pp_string (cxx_pp, "::"); - dump_decl (TREE_OPERAND (t, 1), flags|TFF_UNQUALIFIED_NAME); + dump_decl (TREE_OPERAND (t, 1), TFF_UNQUALIFIED_NAME); break; case ARRAY_REF: diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index d66accfa934..6d7004b98a7 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -1792,6 +1792,23 @@ finish_qualified_id_expr (tree qualifying_class, being taken. */ expr = build_offset_ref (qualifying_class, expr, /*address_p=*/false); } + else if (BASELINK_P (expr)) + ; + else + { + expr = convert_from_reference (expr); + + /* In a template, return a SCOPE_REF for most qualified-ids + so that we can check access at instantiation time. But if + we're looking at a member of the current instantiation, we + know we have access and building up the SCOPE_REF confuses + non-type template argument handling. */ + if (processing_template_decl + && !currently_open_class (qualifying_class)) + expr = build_qualified_name (TREE_TYPE (expr), + qualifying_class, expr, + template_p); + } return expr; } @@ -3253,7 +3270,7 @@ finish_id_expression (tree id_expression, if (TREE_CODE (decl) == FUNCTION_DECL) mark_used (decl); - if (TREE_CODE (decl) == FIELD_DECL || BASELINK_P (decl)) + if (TYPE_P (scope)) decl = finish_qualified_id_expr (scope, decl, done, @@ -3261,21 +3278,7 @@ finish_id_expression (tree id_expression, template_p, template_arg_p); else - { - tree r = convert_from_reference (decl); - - /* In a template, return a SCOPE_REF for most qualified-ids - so that we can check access at instantiation time. But if - we're looking at a member of the current instantiation, we - know we have access and building up the SCOPE_REF confuses - non-type template argument handling. */ - if (processing_template_decl && TYPE_P (scope) - && !currently_open_class (scope)) - r = build_qualified_name (TREE_TYPE (r), - scope, decl, - template_p); - decl = r; - } + decl = convert_from_reference (decl); } else if (TREE_CODE (decl) == FIELD_DECL) { -- 2.11.4.GIT