+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.
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);
{
/* 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
/* 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