aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-05-21 20:57:52 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-05-21 16:57:52 -0400
commitf9c3243c6766fbbf0fc9d921a6e42e58e6c5bbc5 (patch)
tree2621204d5c71cb63c82deccb6ef4e4067e18789d
parent12b195d93665f8aa23b04ac6d8d0d17e93653e07 (diff)
downloadgcc-f9c3243c6766fbbf0fc9d921a6e42e58e6c5bbc5.zip
gcc-f9c3243c6766fbbf0fc9d921a6e42e58e6c5bbc5.tar.gz
gcc-f9c3243c6766fbbf0fc9d921a6e42e58e6c5bbc5.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c12
2 files changed, 12 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e0a3399..fe748e4 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+1998-05-21 Jason Merrill <jason@yorick.cygnus.com>
+
+ * 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 <brolley@cygnus.com>
* lex.c: (handle_sysv_pragma): FILE* parameter not used.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2e50cf9..8763df3 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