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.
* parser.c (cp_parser_template_declaration_after_export): Likewise.
* pt.c (tsubst_friend_class): Likewise.
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:
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;
}
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,
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)
{