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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108947
138bc75d-0d04-0410-961f-
82ee72b054a4
+2005-12-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/23333
+ * c-lex.c (c_lex_with_flags): Add PURE_ZERO to cpp_flags if
+ number is a single digit '0'.
+
2005-12-22 Kazu Hirata <kazu@codesourcery.com>
PR tree-optimization/23518
static bool no_more_pch;
const cpp_token *tok;
enum cpp_ttype type;
+ unsigned char add_flags = 0;
timevar_push (TV_CPP);
retry:
break;
case CPP_N_INTEGER:
+ /* C++ uses '0' to mark virtual functions as pure.
+ Set PURE_ZERO to pass this information to the C++ parser. */
+ if (tok->val.str.len == 1 && *tok->val.str.text == '0')
+ add_flags = PURE_ZERO;
*value = interpret_integer (tok, flags);
break;
}
if (cpp_flags)
- *cpp_flags = tok->flags;
+ *cpp_flags = tok->flags | add_flags;
if (!no_more_pch)
{
+2005-12-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/23333
+ * parser.c (cp_parser_pure_specifier): Check for PURE_ZERO to
+ identify a single '0'.
+
2005-12-20 Mark Mitchell <mark@codesourcery.com>
PR c++/21228
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.
+2005-12-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/23333
+ * g++.dg/parse/error25.C: Add more tests.
+
2005-12-22 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/18990
virtual void bar2 () = __null; // { dg-error "invalid pure specifier" }
virtual void bar3 () = 4; // { dg-error "invalid pure specifier" }
virtual void bar4 () = A::f; // { dg-error "invalid pure specifier" }
+ virtual void bar5 () = 0l; // { dg-error "invalid pure specifier" }
+ virtual void bar6 () = 00; // { dg-error "invalid pure specifier" }
+ virtual void bar7 () = 0x0; // { dg-error "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.
+
2005-12-07 Jon Grimm <jgrimm2@us.ibm.com>
Ben Elliston <bje@au.ibm.com>
#define NAMED_OP (1 << 4) /* C++ named operators. */
#define NO_EXPAND (1 << 5) /* Do not macro-expand this token. */
#define BOL (1 << 6) /* Token at beginning of line. */
+#define PURE_ZERO (1 << 7) /* Single 0 digit, used by the C++ frontend,
+ set in c-lex.c. */
/* Specify which field, if any, of the cpp_token union is used. */