Commit 866eb556 by Kriang Lerdsuwanakij Committed by Kriang Lerdsuwanakij

re PR c++/5421 (friends+templates: ICE: expected identifier_node, have…

re PR c++/5421 (friends+templates: ICE: expected identifier_node, have template_id_expr in grokfndecl, at cp/decl.c:8835)

	PR c++/5421
	* decl.c (grokdeclarator): Handle TEMPLATE_ID_EXPR if friend
	is a member of other class.
	* friend.c (do_friend): Don't build TEMPLATE_DECL if friend
	is a specialization of function template.

	* g++.dg/template/friend21.C: New test.

From-SVN: r69457
parent 94b7906a
2003-07-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/5421
* decl.c (grokdeclarator): Handle TEMPLATE_ID_EXPR if friend
is a member of other class.
* friend.c (do_friend): Don't build TEMPLATE_DECL if friend
is a specialization of function template.
2003-07-16 Gabriel Dos Reis <gdr@integrable-solutions.net>
PR c++/10903
......
......@@ -11488,7 +11488,10 @@ grokdeclarator (tree declarator,
members of other classes. */
/* All method decls are public, so tell grokfndecl to set
TREE_PUBLIC, also. */
decl = grokfndecl (ctype, type, declarator, declarator,
decl = grokfndecl (ctype, type,
TREE_CODE (declarator) != TEMPLATE_ID_EXPR
? declarator : dname,
declarator,
virtualp, flags, quals, raises,
friendp ? -1 : 0, friendp, 1, 0, funcdef_flag,
template_count, in_namespace);
......
......@@ -357,6 +357,8 @@ do_friend (tree ctype, tree declarator, tree decl, tree parmdecls,
if (is_friend_template)
decl = DECL_TI_TEMPLATE (push_template_decl (decl));
else if (DECL_TEMPLATE_INFO (decl))
;
else if (template_class_depth (current_class_type))
decl = push_template_decl_real (decl, /*is_friend=*/1);
......
2003-07-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/5421
* g++.dg/template/friend21.C: New test.
2003-07-16 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/cleanup-8.c: New test.
......
// { dg-do compile }
// Origin: ajl13@bellatlantic.net
// PR c++/5421: ICE for specialization of member function template
// as friend.
struct B {
template <class T> void b();
};
template <class T> class A {
friend void B::b<T>();
};
static A<int> a;
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