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
This commit is contained in:
Mark Mitchell 1999-10-07 16:41:48 +00:00 committed by Mark Mitchell
parent ab150fb189
commit c219b87877
3 changed files with 20 additions and 4 deletions

View File

@ -1,3 +1,10 @@
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.

View File

@ -277,7 +277,8 @@ make_friend_class (type, friend_type)
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]
@ -290,9 +291,17 @@ make_friend_class (type, friend_type)
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;
}

View File

@ -1480,7 +1480,7 @@ finish_object_call_expr (fn, object, args)
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: