adjust_processing_template_decl = true;
--processing_template_decl;
}
- else if (TREE_CODE (friend_type) != BOUND_TEMPLATE_TEMPLATE_PARM
- && !CLASSTYPE_USE_TEMPLATE (friend_type)
- && TYPE_HIDDEN_P (friend_type))
- {
- /* friend class C;
-
- where C hasn't been declared yet. Let's lookup name
- from namespace scope directly, bypassing any name that
- come from dependent base class. */
- tree ns = decl_namespace_context (TYPE_MAIN_DECL (friend_type));
-
- /* The call to xref_tag_from_type does injection for friend
- classes. */
- push_nested_namespace (ns);
- friend_type =
- xref_tag_from_type (friend_type, NULL_TREE,
- /*tag_scope=*/ts_current);
- pop_nested_namespace (ns);
- }
else if (uses_template_parms (friend_type))
/* friend class C<T>; */
friend_type = tsubst (friend_type, args,
template <typename T = void>
class bar {
public:
- friend class foo; // this is not bar::foo, it forward-declares ::foo
+ friend class foo; // this is not bar::foo, it injects hidden ::foo
class foo {};
bar() { foo(); } // but this should refer to bar::foo
};
bar<> baz;
+
+// We still have not made foo visible.
+foo *b; // { dg-error "does not name a type" }