aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2005-02-01 01:01:34 +0000
committerMark Mitchell <mark@codesourcery.com>2005-02-01 01:01:34 +0000
commit7f17aa07cabcb2d3d9244ce37c1ae9ec16f2cd1f (patch)
treecfa0b1e39e621b716ae38190c9b764f2198c23ed /gcc/cp/decl.c
parent718011e8a752e8835641eb4e5bc93d56f0acddd4 (diff)
* decl.c (build_enumerator): Do not issue duplicate error messages
about invalid enumeration constants. * parser.c (cp_parser_non_integral_constant_expression): Always set parser->non_integral_constant_expression_p. (cp_parser_primary_expression): Add cast_p parameter. Issue errors about invalid uses of floating-point literals in cast-expressions. (cp_parser_postfix_expression): Add cast_p parameter. (cp_parser_open_square_expression): Pass it. (cp_parser_parenthesized_expression_list): Add cast_p parameter. (cp_parser_unary_expression): Likewise. (cp_parser_new_placement): Pass it. (cp_parser_direct_new_declarator): Likewise. (cp_parser_new_initializer): Likewise. (cp_parser_cast_expression): Add cast_p parameter. (cp_parser_binary_expression): Likewise. (cp_parser_question_colon_clause): Likewise. (cp_parser_assignment_expression): Likewise. (cp_parser_expression): Likewise. (cp_parser_constant_expression): If an integral constant expression is invalid, return error_mark_node. (cp_parser_expression_statement): Pass cast_p. (cp_parser_condition): Likewise. (cp_parser_iteration_statement): Likewise. (cp_parser_jump_statement): Likewise. (cp_parser_mem_initializer): Likewise. (cp_parser_template_argument): Likewise. (cp_parser_parameter_declaration): Likewise. (cp_parser_initializer): Likewise. (cp_parser_throw_expression): Likewise. (cp_parser_attribute_list): Likewise. (cp_parser_simple_cast_expression): Likewise. (cp_parser_functional_cast): Likewise. (cp_parser_late_parsing_default_args): Likewise. (cp_parser_sizeof_operand): Save/restore non_integral_constant_expression_p. * include/std/std_limits.h (numeric_limits<float>::has_denorm): Add required cast. (numeric_limits<double>::has_denorm): Likewise. (numeric_limits<long double>::has_denorm): Likewise. * g++.dg/other/warning1.C: Adjust error messags. * g++.dg/parse/constant5.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@94512 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 964feaa08fe..9be5adf4af3 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -9682,6 +9682,11 @@ build_enumerator (tree name, tree value, tree enumtype)
tree context;
tree type;
+ /* If the VALUE was erroneous, pretend it wasn't there; that will
+ result in the enum being assigned the next value in sequence. */
+ if (value == error_mark_node)
+ value = NULL_TREE;
+
/* Remove no-op casts from the value. */
if (value)
STRIP_TYPE_NOPS (value);