From: Jason Merrill Date: Thu, 21 May 1998 20:57:52 +0000 (+0000) Subject: pt.c (tsubst_friend_class): Don't call redeclare_class_template if the template we... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f9c3243c6766fbbf0fc9d921a6e42e58e6c5bbc5;p=gcc.git pt.c (tsubst_friend_class): Don't call redeclare_class_template if the template we looked up is the same as... * pt.c (tsubst_friend_class): Don't call redeclare_class_template if the template we looked up is the same as the one we already have. From-SVN: r19935 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e0a339913c9..fe748e48556 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +1998-05-21 Jason Merrill + + * pt.c (tsubst_friend_class): Don't call redeclare_class_template + if the template we looked up is the same as the one we already + have. + Thu May 21 11:54:44 1998 Dave Brolley * lex.c: (handle_sysv_pragma): FILE* parameter not used. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2e50cf98109..8763df3ad1f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3510,8 +3510,8 @@ tsubst_friend_class (friend_type, args) tree friend_type; tree args; { - tree tmpl = - lookup_name (DECL_NAME (CLASSTYPE_TI_TEMPLATE (friend_type)), 1); + tree friend_tmpl = CLASSTYPE_TI_TEMPLATE (friend_type); + tree tmpl = lookup_name (DECL_NAME (friend_tmpl), 1); tmpl = maybe_get_template_decl_from_type_decl (tmpl); @@ -3519,9 +3519,9 @@ tsubst_friend_class (friend_type, args) { /* The friend template has already been declared. Just check to see that the declarations match. */ - redeclare_class_template (TREE_TYPE (tmpl), - DECL_TEMPLATE_PARMS (CLASSTYPE_TI_TEMPLATE - (friend_type))); + if (tmpl != friend_tmpl) + redeclare_class_template (TREE_TYPE (tmpl), + DECL_TEMPLATE_PARMS (friend_tmpl)); friend_type = TREE_TYPE (tmpl); } else @@ -3529,7 +3529,7 @@ tsubst_friend_class (friend_type, args) /* The friend template has not already been declared. In this case, the instantiation of the template class will cause the injection of this template into the global scope. */ - tmpl = tsubst (CLASSTYPE_TI_TEMPLATE (friend_type), args, NULL_TREE); + tmpl = tsubst (friend_tmpl, args, NULL_TREE); /* The new TMPL is not an instantiation of anything, so we forget its origins. We don't reset CLASSTYPE_TI_TEMPLATE for