"division by zero in preprocessor expression")
DIAG(err_pp_remainder_by_zero, ERROR,
"remainder by zero in preprocessor expression")
-DIAG(err_pp_expr_bad_token, ERROR,
- "token is not valid in preprocessor expressions")
+DIAG(err_pp_expr_bad_token_binop, ERROR,
+ "token is not a valid binary operator in a preprocessor subexpression")
+DIAG(err_pp_expr_bad_token_start_expr, ERROR,
+ "invalid token at start of a preprocessor expression")
DIAG(err_pp_invalid_poison, ERROR,
"can only poison identifier tokens")
DIAG(err_pp_used_poisoned_id, ERROR,
switch (PeekTok.getKind()) {
default: // Non-value token.
- PP.Diag(PeekTok, diag::err_pp_expr_bad_token);
+ PP.Diag(PeekTok, diag::err_pp_expr_bad_token_start_expr);
return true;
case tok::eom:
case tok::r_paren:
unsigned PeekPrec = getPrecedence(PeekTok.getKind());
// If this token isn't valid, report the error.
if (PeekPrec == ~0U) {
- PP.Diag(PeekTok, diag::err_pp_expr_bad_token);
+ PP.Diag(PeekTok, diag::err_pp_expr_bad_token_binop);
return true;
}
// If this token isn't valid, report the error.
if (PeekPrec == ~0U) {
- PP.Diag(PeekTok, diag::err_pp_expr_bad_token);
+ PP.Diag(PeekTok, diag::err_pp_expr_bad_token_binop);
return true;
}
--- /dev/null
+// RUN: not clang -E %s 2>&1 | grep 'invalid token at start of a preprocessor expression'
+// RUN: not clang -E %s 2>&1 | grep 'token is not a valid binary operator in a preprocessor subexpression'
+// PR2220
+
+#if 1 * * 2
+#endif
+
+#if 4 [ 2
+#endif
+