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
This commit is contained in:
parent
94b7906a3a
commit
866eb556c2
@ -1,3 +1,11 @@
|
||||
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);
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
16
gcc/testsuite/g++.dg/template/friend21.C
Normal file
16
gcc/testsuite/g++.dg/template/friend21.C
Normal file
@ -0,0 +1,16 @@
|
||||
// { 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;
|
Loading…
Reference in New Issue
Block a user