diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-11-13 23:03:19 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-11-13 23:03:19 +0000 |
commit | 98710fc4f549f70a094690c70272cb6cbda6fb02 (patch) | |
tree | caedd9da1957ade7437488d331b5b654389443e7 /clang/lib/AST/ExprConstant.cpp | |
parent | da59f3de450d31b8bc9f21e217d45f6f9ceeadd7 (diff) | |
download | bcm5719-llvm-98710fc4f549f70a094690c70272cb6cbda6fb02.tar.gz bcm5719-llvm-98710fc4f549f70a094690c70272cb6cbda6fb02.zip |
Fix assert/crash on invalid with __builtin_constant_p conditionals in constant expressions.
llvm-svn: 221942
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 2ce5ac590bd..ea28d74ddc7 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -8971,7 +8971,11 @@ static bool EvaluateCPlusPlus11IntegralConstantExpr(const ASTContext &Ctx, 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; } |