semantics.c (finish_qualified_id_expr): Handle building up a non-dependent SCOPE_REF here.

* 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.

From-SVN: r190829
This commit is contained in:
Jason Merrill 2012-08-30 22:50:18 -04:00 committed by Jason Merrill
parent 091bffba90
commit e467c9d257
3 changed files with 25 additions and 17 deletions

View File

@ -1,5 +1,10 @@
2012-08-30 Jason Merrill <jason@redhat.com> 2012-08-30 Jason Merrill <jason@redhat.com>
* 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. * friend.c (make_friend_class): Handle template template parameters.
* parser.c (cp_parser_template_declaration_after_export): Likewise. * parser.c (cp_parser_template_declaration_after_export): Likewise.
* pt.c (tsubst_friend_class): Likewise. * pt.c (tsubst_friend_class): Likewise.

View File

@ -1042,7 +1042,7 @@ dump_decl (tree t, int flags)
case SCOPE_REF: case SCOPE_REF:
dump_type (TREE_OPERAND (t, 0), flags); dump_type (TREE_OPERAND (t, 0), flags);
pp_string (cxx_pp, "::"); pp_string (cxx_pp, "::");
dump_decl (TREE_OPERAND (t, 1), flags|TFF_UNQUALIFIED_NAME); dump_decl (TREE_OPERAND (t, 1), TFF_UNQUALIFIED_NAME);
break; break;
case ARRAY_REF: case ARRAY_REF:

View File

@ -1792,6 +1792,23 @@ finish_qualified_id_expr (tree qualifying_class,
being taken. */ being taken. */
expr = build_offset_ref (qualifying_class, expr, /*address_p=*/false); 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; return expr;
} }
@ -3253,7 +3270,7 @@ finish_id_expression (tree id_expression,
if (TREE_CODE (decl) == FUNCTION_DECL) if (TREE_CODE (decl) == FUNCTION_DECL)
mark_used (decl); mark_used (decl);
if (TREE_CODE (decl) == FIELD_DECL || BASELINK_P (decl)) if (TYPE_P (scope))
decl = finish_qualified_id_expr (scope, decl = finish_qualified_id_expr (scope,
decl, decl,
done, done,
@ -3261,21 +3278,7 @@ finish_id_expression (tree id_expression,
template_p, template_p,
template_arg_p); template_arg_p);
else else
{ decl = convert_from_reference (decl);
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;
}
} }
else if (TREE_CODE (decl) == FIELD_DECL) else if (TREE_CODE (decl) == FIELD_DECL)
{ {