aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-08-28 17:36:09 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-08-28 17:36:09 +0000
commit479781c51360fe41b9e0f4222157f8d12f4db43f (patch)
tree7516bd060c71ba09c05db7cdb4c171323e8055f3
parent818c8883753d6c2224145418f9f1f0764c999e2a (diff)
downloadgcc-479781c51360fe41b9e0f4222157f8d12f4db43f.zip
gcc-479781c51360fe41b9e0f4222157f8d12f4db43f.tar.gz
gcc-479781c51360fe41b9e0f4222157f8d12f4db43f.tar.bz2
* lex.c (do_identifier): Fix thinko in previous change.
From-SVN: r22064
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/lex.c13
2 files changed, 15 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index dcf090b..bc93b87 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+1998-08-28 Mark Mitchell <mark@markmitchell.com>
+
+ * lex.c (do_identifier): Fix thinko in previous change.
+
1998-08-28 Jason Merrill <jason@yorick.cygnus.com>
* search.c (dfs_search, binfo_for_vtable, dfs_bfv_helper): New fns.
@@ -20,12 +24,13 @@
* decl.c (finish_enum): Don't set the TREE_TYPE for the
enumeration constant values if we're processing_template_decls.
Don't set the type for the CONST_DECLs either; that's done in
- build_enumerator. (
+ build_enumerator.
(build_enumerator): Take the enumeration type as a
- paramter.
+ parameter.
* lex.c (do_identifier): Don't resolve enumeration constants while
processing template declarations, even if they happen to be
TEMPLATE_PARM_INDEXs.
+
* parse.y (current_enum_type): New variable.
(primary): Don't allow statement-expression in local classes just
as we don't in global classes.
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index 915b660..859a6be 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -2985,11 +2985,14 @@ do_identifier (token, parsing, args)
/* protected is OK, since it's an enum of `this'. */
}
if (!processing_template_decl
- /* Don't resolve enumeration constants while processing
- template declarations, unless they're for global
- enumerations and therefore cannot involve template
- parameters. */
- || (!DECL_CONTEXT (id)
+ /* Really, if we're processing a template, we just want to
+ resolve template parameters, and not enumeration
+ constants. But, they're hard to tell apart. (Note that
+ a non-type template parameter may have enumeration type.)
+ Fortunately, there's no harm in resolving *global*
+ enumeration constants, since they can't depend on
+ template parameters. */
+ || (TREE_CODE (CP_DECL_CONTEXT (id)) == NAMESPACE_DECL
&& TREE_CODE (DECL_INITIAL (id)) == TEMPLATE_PARM_INDEX))
id = DECL_INITIAL (id);
}