aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJody Goldberg <jodyg@idt.net>1997-09-08 09:37:29 +0000
committerJason Merrill <jason@gcc.gnu.org>1997-09-08 05:37:29 -0400
commitb3d5a58b519ee457be4c5a69ef1d8b6f5bb1dae7 (patch)
tree2d1a50eadf42b66e125138c2250f3c3dd1aa8809 /gcc
parent786b5245966e3e9b710015ce7fd28992391d891b (diff)
downloadgcc-b3d5a58b519ee457be4c5a69ef1d8b6f5bb1dae7.zip
gcc-b3d5a58b519ee457be4c5a69ef1d8b6f5bb1dae7.tar.gz
gcc-b3d5a58b519ee457be4c5a69ef1d8b6f5bb1dae7.tar.bz2
decl.c (current_local_enum): Remove static.
Mon Sep 8 02:33:20 1997 Jody Goldberg <jodyg@idt.net> * decl.c (current_local_enum): Remove static. * pt.c (tsubst_enum): Save and restore value of current_local_enum in case template is expanded in enum decl. (instantiate_class_template) : Use new tsubst_enum signature. (tsubst_expr): Likewise. From-SVN: r15156
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog8
-rw-r--r--gcc/cp/decl.c2
-rw-r--r--gcc/cp/pt.c18
3 files changed, 22 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 213ac39..0bd033f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,11 @@
+Mon Sep 8 02:33:20 1997 Jody Goldberg <jodyg@idt.net>
+
+ * decl.c (current_local_enum): Remove static.
+ * pt.c (tsubst_enum): Save and restore value of current_local_enum
+ in case template is expanded in enum decl.
+ (instantiate_class_template) : Use new tsubst_enum signature.
+ (tsubst_expr): Likewise.
+
Mon Sep 8 01:21:43 1997 Mark Mitchell <mmitchell@usa.net>
* pt.c (begin_member_template_processing): Take a function as
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1e5a56f..3543ddd 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10797,7 +10797,7 @@ xref_basetypes (code_type_node, name, ref, binfo)
}
-static tree current_local_enum = NULL_TREE;
+tree current_local_enum = NULL_TREE;
/* Begin compiling the definition of an enumeration type.
NAME is its name (or null if anonymous).
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 0c24ec4..88af38b 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -76,7 +76,7 @@ static int comp_template_args PROTO((tree, tree));
static int list_eq PROTO((tree, tree));
static tree get_class_bindings PROTO((tree, tree, tree));
static tree coerce_template_parms PROTO((tree, tree, tree));
-static tree tsubst_enum PROTO((tree, tree, int));
+static tree tsubst_enum PROTO((tree, tree, int, tree *));
static tree add_to_template_args PROTO((tree, tree));
/* Restore the template parameter context. */
@@ -1450,9 +1450,8 @@ instantiate_class_template (type)
if (TREE_CODE (tag) == ENUMERAL_TYPE)
{
tree e, newtag = tsubst_enum (tag, args,
- TREE_VEC_LENGTH (args));
+ TREE_VEC_LENGTH (args), field_chain);
- *field_chain = grok_enum_decls (newtag, NULL_TREE);
while (*field_chain)
{
DECL_FIELD_CONTEXT (*field_chain) = type;
@@ -2840,7 +2839,7 @@ tsubst_expr (t, args, nargs, in_decl)
lineno = TREE_COMPLEXITY (t);
t = TREE_TYPE (t);
if (TREE_CODE (t) == ENUMERAL_TYPE)
- tsubst_enum (t, args, nargs);
+ tsubst_enum (t, args, nargs, NULL);
break;
default:
@@ -4053,10 +4052,14 @@ add_maybe_template (d, fns)
tsubst_expr. */
static tree
-tsubst_enum (tag, args, nargs)
+tsubst_enum (tag, args, nargs, field_chain)
tree tag, args;
int nargs;
+ tree * field_chain;
{
+ extern tree current_local_enum;
+ tree prev_local_enum = current_local_enum;
+
tree newtag = start_enum (TYPE_IDENTIFIER (tag));
tree e, values = NULL_TREE;
@@ -4071,5 +4074,10 @@ tsubst_enum (tag, args, nargs)
finish_enum (newtag, values);
+ if (NULL != field_chain)
+ *field_chain = grok_enum_decls (newtag, NULL_TREE);
+
+ current_local_enum = prev_local_enum;
+
return newtag;
}