aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>2005-12-22 12:01:44 +0000
committerVolker Reichelt <reichelt@gcc.gnu.org>2005-12-22 12:01:44 +0000
commitab84748af1b9eb158f6a2cb0d2f8be97f196a5f2 (patch)
treeb94f65ebd41d3c48ba009c669b5ad7aae0e5fc93 /gcc/cp/parser.c
parent110eec241d7bc08f91573738b449bafbb52e3498 (diff)
downloadgcc-ab84748af1b9eb158f6a2cb0d2f8be97f196a5f2.zip
gcc-ab84748af1b9eb158f6a2cb0d2f8be97f196a5f2.tar.gz
gcc-ab84748af1b9eb158f6a2cb0d2f8be97f196a5f2.tar.bz2
re PR c++/23333 (accepts invalid pure specifier)
2005-12-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de> PR c++/23333 * include/cpplib.h: Add PURE_ZERO to flags for the cpp_token structure. * c-lex.c (c_lex_with_flags): Add PURE_ZERO to cpp_flags if number is a single digit '0'. * parser.c (cp_parser_pure_specifier): Check for PURE_ZERO to identify a single '0'. * g++.dg/parse/error25.C: Add more tests. From-SVN: r108947
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 3079faa..ca56176 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -13648,18 +13648,13 @@ cp_parser_pure_specifier (cp_parser* parser)
return error_mark_node;
/* Look for the `0' token. */
token = cp_lexer_consume_token (parser->lexer);
- if (token->type != CPP_NUMBER || !integer_zerop (token->value))
- {
- cp_parser_error (parser,
- "invalid pure specifier (only `= 0' is allowed)");
- cp_parser_skip_to_end_of_statement (parser);
- return error_mark_node;
- }
+ /* c_lex_with_flags marks a single digit '0' with PURE_ZERO. */
+ if (token->type == CPP_NUMBER && (token->flags & PURE_ZERO))
+ return integer_zero_node;
- /* FIXME: Unfortunately, this will accept `0L' and `0x00' as well.
- We need to get information from the lexer about how the number
- was spelled in order to fix this problem. */
- return integer_zero_node;
+ cp_parser_error (parser, "invalid pure specifier (only `= 0' is allowed)");
+ cp_parser_skip_to_end_of_statement (parser);
+ return error_mark_node;
}
/* Parse a constant-initializer.