token->keyword = RID_MAX;
token->pragma_kind = PRAGMA_NONE;
token->purged_p = false;
+ token->error_reported = false;
/* On some systems, some header files are surrounded by an
implicit extern "C" block. Set a flag in the token if it
C_SET_RID_CODE (token->u.value, RID_MAX);
}
- token->ambiguous_p = false;
token->keyword = RID_MAX;
}
}
if (token->type == CPP_NESTED_NAME_SPECIFIER)
{
cp_token *next = cp_lexer_peek_nth_token (parser->lexer, 2);
- if (next->type == CPP_NAME && next->ambiguous_p)
+ if (next->type == CPP_NAME && next->error_reported)
goto out;
}
we've already issued an error message; there's no reason
to check again. */
if (id_expr_token->type == CPP_NAME
- && id_expr_token->ambiguous_p)
+ && id_expr_token->error_reported)
{
cp_parser_simulate_error (parser);
return error_mark_node;
token = cp_lexer_consume_token (parser->lexer);
if (!error_p)
{
- if (!token->ambiguous_p)
+ if (!token->error_reported)
{
tree decl;
tree ambiguous_decls;
tree lambda_expr = build_lambda_expr ();
tree type;
bool ok = true;
+ cp_token *token = cp_lexer_peek_token (parser->lexer);
- LAMBDA_EXPR_LOCATION (lambda_expr)
- = cp_lexer_peek_token (parser->lexer)->location;
+ LAMBDA_EXPR_LOCATION (lambda_expr) = token->location;
if (cp_unevaluated_operand)
{
- error_at (LAMBDA_EXPR_LOCATION (lambda_expr),
- "lambda-expression in unevaluated context");
+ if (!token->error_reported)
+ {
+ error_at (LAMBDA_EXPR_LOCATION (lambda_expr),
+ "lambda-expression in unevaluated context");
+ token->error_reported = true;
+ }
ok = false;
}
/* Look for the identifier. */
identifier_token = cp_lexer_peek_token (parser->lexer);
- ambiguous_p = identifier_token->ambiguous_p;
+ ambiguous_p = identifier_token->error_reported;
identifier = cp_parser_identifier (parser);
/* If the next token isn't an identifier, we are certainly not
looking at a class-name. */
ENUM_BITFIELD (pragma_kind) pragma_kind : 6;
/* True if this token is from a context where it is implicitly extern "C" */
BOOL_BITFIELD implicit_extern_c : 1;
- /* True for a CPP_NAME token that is not a keyword (i.e., for which
- KEYWORD is RID_MAX) iff this name was looked up and found to be
- ambiguous. An error has already been reported. */
- BOOL_BITFIELD ambiguous_p : 1;
+ /* True if an error has already been reported for this token, such as a
+ CPP_NAME token that is not a keyword (i.e., for which KEYWORD is
+ RID_MAX) iff this name was looked up and found to be ambiguous. */
+ BOOL_BITFIELD error_reported : 1;
/* True for a token that has been purged. If a token is purged,
it is no longer a valid token and it should be considered
deleted. */