aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-03-01 21:07:22 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-03-01 16:07:22 -0500
commit574817a219778a2800ff781cb583205b391821f0 (patch)
treee2752f6fe2f012885159b6748862769c1389710b /gcc
parentab63953e195fafba4a81e18d6f785a8b2fb60669 (diff)
downloadgcc-574817a219778a2800ff781cb583205b391821f0.zip
gcc-574817a219778a2800ff781cb583205b391821f0.tar.gz
gcc-574817a219778a2800ff781cb583205b391821f0.tar.bz2
pt.c (instantiate_class_template): Don't mess with friends if our type uses template parms.
* pt.c (instantiate_class_template): Don't mess with friends if our type uses template parms. From-SVN: r18350
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c105
2 files changed, 56 insertions, 54 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c112577..cf011cc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+Sun Mar 1 21:06:37 1998 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (instantiate_class_template): Don't mess with friends if
+ our type uses template parms.
+
Sat Feb 28 12:06:44 1998 Jason Merrill <jason@yorick.cygnus.com>
* parse.y (nested_name_specifier): Use explicit_template_type.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 015604f..027700e 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3153,74 +3153,71 @@ instantiate_class_template (type)
grok_op_properties (t, DECL_VIRTUAL_P (t), 0);
}
- /* Construct the DECL_FRIENDLIST for the new class type. */
- typedecl = TYPE_MAIN_DECL (type);
- for (t = DECL_FRIENDLIST (TYPE_MAIN_DECL (pattern));
- t != NULL_TREE;
- t = TREE_CHAIN (t))
+ if (! uses_template_parms (type))
{
- tree friends;
+ /* Construct the DECL_FRIENDLIST for the new class type. */
+ typedecl = TYPE_MAIN_DECL (type);
+ for (t = DECL_FRIENDLIST (TYPE_MAIN_DECL (pattern));
+ t != NULL_TREE;
+ t = TREE_CHAIN (t))
+ {
+ tree friends;
- DECL_FRIENDLIST (typedecl)
- = tree_cons (TREE_PURPOSE (t), NULL_TREE,
- DECL_FRIENDLIST (typedecl));
+ DECL_FRIENDLIST (typedecl)
+ = tree_cons (TREE_PURPOSE (t), NULL_TREE,
+ DECL_FRIENDLIST (typedecl));
- for (friends = TREE_VALUE (t);
- friends != NULL_TREE;
- friends = TREE_CHAIN (friends))
- {
- if (TREE_PURPOSE (friends) == error_mark_node)
+ for (friends = TREE_VALUE (t);
+ friends != NULL_TREE;
+ friends = TREE_CHAIN (friends))
{
- TREE_VALUE (DECL_FRIENDLIST (typedecl))
- = tree_cons (error_mark_node,
- tsubst_friend_function (TREE_VALUE (friends),
- args),
- TREE_VALUE (DECL_FRIENDLIST (typedecl)));
- }
- else
- {
- TREE_VALUE (DECL_FRIENDLIST (typedecl))
- = tree_cons (tsubst (TREE_PURPOSE (friends), args, NULL_TREE),
- NULL_TREE,
- TREE_VALUE (DECL_FRIENDLIST (typedecl)));
+ if (TREE_PURPOSE (friends) == error_mark_node)
+ {
+ TREE_VALUE (DECL_FRIENDLIST (typedecl))
+ = tree_cons (error_mark_node,
+ tsubst_friend_function (TREE_VALUE (friends),
+ args),
+ TREE_VALUE (DECL_FRIENDLIST (typedecl)));
+ }
+ else
+ {
+ TREE_VALUE (DECL_FRIENDLIST (typedecl))
+ = tree_cons (tsubst (TREE_PURPOSE (friends), args, NULL_TREE),
+ NULL_TREE,
+ TREE_VALUE (DECL_FRIENDLIST (typedecl)));
+ }
}
}
- }
- {
- tree d = CLASSTYPE_FRIEND_CLASSES (type)
- = tsubst (CLASSTYPE_FRIEND_CLASSES (pattern), args, NULL_TREE);
+ t = CLASSTYPE_FRIEND_CLASSES (type)
+ = tsubst (CLASSTYPE_FRIEND_CLASSES (pattern), args, NULL_TREE);
- /* This does injection for friend classes. */
- for (; d; d = TREE_CHAIN (d))
- TREE_VALUE (d) = xref_tag_from_type (TREE_VALUE (d), NULL_TREE, 1);
+ /* This does injection for friend classes. */
+ for (; t; t = TREE_CHAIN (t))
+ TREE_VALUE (t) = xref_tag_from_type (TREE_VALUE (t), NULL_TREE, 1);
- /* This does injection for friend functions. */
- if (!processing_template_decl)
- {
- d = tsubst (DECL_TEMPLATE_INJECT (template), args, NULL_TREE);
+ /* This does injection for friend functions. */
+ if (!processing_template_decl)
+ {
+ t = tsubst (DECL_TEMPLATE_INJECT (template), args, NULL_TREE);
- for (; d; d = TREE_CHAIN (d))
- {
- tree t = TREE_VALUE (d);
+ for (; t; t = TREE_CHAIN (t))
+ {
+ tree d = TREE_VALUE (t);
- if (TREE_CODE (t) == TYPE_DECL)
- /* Already injected. */;
- else
- pushdecl (t);
- }
- }
- }
+ if (TREE_CODE (d) == TYPE_DECL)
+ /* Already injected. */;
+ else
+ pushdecl (d);
+ }
+ }
- if (! uses_template_parms (type))
- {
- tree tmp;
- for (tmp = TYPE_FIELDS (type); tmp; tmp = TREE_CHAIN (tmp))
- if (TREE_CODE (tmp) == FIELD_DECL)
+ for (t = TYPE_FIELDS (type); t; t = TREE_CHAIN (t))
+ if (TREE_CODE (t) == FIELD_DECL)
{
- TREE_TYPE (tmp) = complete_type (TREE_TYPE (tmp));
- require_complete_type (tmp);
+ TREE_TYPE (t) = complete_type (TREE_TYPE (t));
+ require_complete_type (t);
}
type = finish_struct_1 (type, 0);