Fix assert/crash on invalid with __builtin_constant_p conditionals in constant expressions.
llvm-svn: 221942
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 2ce5ac5..ea28d74 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -8971,7 +8971,11 @@
if (!E->isCXX11ConstantExpr(Ctx, &Result, Loc))
return false;
- assert(Result.isInt() && "pointer cast to int is not an ICE");
+ if (!Result.isInt()) {
+ if (Loc) *Loc = E->getExprLoc();
+ return false;
+ }
+
if (Value) *Value = Result.getInt();
return true;
}