diff options
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 2 | ||||
| -rw-r--r-- | clang/test/Sema/i-c-e.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index d5976386991..41132741a56 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -6734,7 +6734,7 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) { if (FalseResult.Val == 2) return FalseResult; if (CommonResult.Val == 1) return CommonResult; if (FalseResult.Val == 1 && - Exp->getCommon()->EvaluateKnownConstInt(Ctx) == 0) return NoDiag(); + Exp->getCommon()->EvaluateKnownConstInt(Ctx) != 0) return NoDiag(); return FalseResult; } case Expr::ConditionalOperatorClass: { diff --git a/clang/test/Sema/i-c-e.c b/clang/test/Sema/i-c-e.c index e7b42c4e9a1..7749b6c1a0f 100644 --- a/clang/test/Sema/i-c-e.c +++ b/clang/test/Sema/i-c-e.c @@ -73,3 +73,5 @@ int illegaldiv4[0 / (1 / 0)]; // expected-error {{variable length array declarat int chooseexpr[__builtin_choose_expr(1, 1, expr)]; int realop[(__real__ 4) == 4 ? 1 : -1]; int imagop[(__imag__ 4) == 0 ? 1 : -1]; + +int *PR14729 = 0 ?: 1/0; // expected-error {{not a compile-time constant}} expected-warning 3{{}} |

