forked from OSchip/llvm-project
Add fixit hint for missing ':' in ternary expressions.
llvm-svn: 101073
This commit is contained in:
parent
393c4df342
commit
e601365de9
|
@ -336,7 +336,8 @@ Parser::ParseRHSOfBinaryExpression(OwningExprResult LHS, unsigned MinPrec) {
|
|||
}
|
||||
|
||||
if (Tok.isNot(tok::colon)) {
|
||||
Diag(Tok, diag::err_expected_colon);
|
||||
Diag(Tok, diag::err_expected_colon)
|
||||
<< FixItHint::CreateInsertion(Tok.getLocation(), ": ");
|
||||
Diag(OpToken, diag::note_matching) << "?";
|
||||
return ExprError();
|
||||
}
|
||||
|
|
|
@ -31,3 +31,8 @@ void f1(x, y)
|
|||
|
||||
int i0 = { 17 };
|
||||
|
||||
int test_cond(int y) {
|
||||
// CHECK: int x = y ? 1 : 2;
|
||||
int x = y ? 1 2;
|
||||
return x;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue