Commit c219b878 by Mark Mitchell Committed by Mark Mitchell

friend.c (make_friend_class): Robustify.

	* friend.c (make_friend_class): Robustify.

	* semantics.c (finish_object_call_expr): Reject calls to template
	types.

From-SVN: r29855
parent ab150fb1
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> 1999-10-06 Mark Mitchell <mark@codesourcery.com>
* dump.c (dequeue_and_dump): Dump all three operands to a COND_EXPR. * dump.c (dequeue_and_dump): Dump all three operands to a COND_EXPR.
......
...@@ -277,7 +277,8 @@ make_friend_class (type, friend_type) ...@@ -277,7 +277,8 @@ make_friend_class (type, friend_type)
is_template_friend = 0; is_template_friend = 0;
if (is_template_friend 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] /* [temp.friend]
...@@ -290,9 +291,17 @@ make_friend_class (type, friend_type) ...@@ -290,9 +291,17 @@ make_friend_class (type, friend_type)
template <class T> friend typename S<T>::X; template <class T> friend typename S<T>::X;
or:
template <class T> friend class T;
which isn't any of these. */ which isn't any of these. */
cp_error ("typename type `%T' declared `friend'", if (TREE_CODE (friend_type) == TYPENAME_TYPE)
friend_type); cp_error ("typename type `%T' declared `friend'",
friend_type);
else
cp_error ("template parameter type `%T' declared `friend'",
friend_type);
return; return;
} }
......
...@@ -1480,7 +1480,7 @@ finish_object_call_expr (fn, object, args) ...@@ -1480,7 +1480,7 @@ finish_object_call_expr (fn, object, args)
tree real_fn = build_component_ref (object, fn, NULL_TREE, 1); tree real_fn = build_component_ref (object, fn, NULL_TREE, 1);
return finish_call_expr (real_fn, args); return finish_call_expr (real_fn, args);
#else #else
if (TREE_CODE (fn) == TYPE_DECL) if (DECL_DECLARES_TYPE_P (fn))
{ {
if (processing_template_decl) if (processing_template_decl)
/* This can happen on code like: /* This can happen on code like:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment