* friend.c (make_friend_class): Robustify.
* semantics.c (finish_object_call_expr): Reject calls to template
types.
From-SVN: r29855
+1999-10-07 Mark Mitchell <mark@codesourcery.com>
+
+ * friend.c (make_friend_class): Robustify.
+
+ * semantics.c (finish_object_call_expr): Reject calls to template
+ types.
+
1999-10-06 Mark Mitchell <mark@codesourcery.com>
* dump.c (dequeue_and_dump): Dump all three operands to a COND_EXPR.
is_template_friend = 0;
if (is_template_friend
- && TREE_CODE (friend_type) == TYPENAME_TYPE)
+ && (TREE_CODE (friend_type) == TYPENAME_TYPE
+ || TREE_CODE (friend_type) == TEMPLATE_TYPE_PARM))
{
/* [temp.friend]
template <class T> friend typename S<T>::X;
+ or:
+
+ template <class T> friend class T;
+
which isn't any of these. */
- cp_error ("typename type `%T' declared `friend'",
- friend_type);
+ if (TREE_CODE (friend_type) == TYPENAME_TYPE)
+ cp_error ("typename type `%T' declared `friend'",
+ friend_type);
+ else
+ cp_error ("template parameter type `%T' declared `friend'",
+ friend_type);
return;
}
tree real_fn = build_component_ref (object, fn, NULL_TREE, 1);
return finish_call_expr (real_fn, args);
#else
- if (TREE_CODE (fn) == TYPE_DECL)
+ if (DECL_DECLARES_TYPE_P (fn))
{
if (processing_template_decl)
/* This can happen on code like: