aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Parse/ParseExpr.cpp3
-rw-r--r--test/FixIt/fixit.c5
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp
index e479c36792..ee714e8e24 100644
--- a/lib/Parse/ParseExpr.cpp
+++ b/lib/Parse/ParseExpr.cpp
@@ -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();
}
diff --git a/test/FixIt/fixit.c b/test/FixIt/fixit.c
index 7ee5575cf2..4c506df016 100644
--- a/test/FixIt/fixit.c
+++ b/test/FixIt/fixit.c
@@ -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;
+}