diff options
author | Bill Wendling <isanbard@gmail.com> | 2018-11-26 02:10:53 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2018-11-26 02:10:53 +0000 |
commit | 372b1e796be6f4dbe872feed6beae27c5c9d4d26 (patch) | |
tree | 0058ff6e91cbe683b4716b548e87df01776a77fb /clang/lib/AST/ExprConstant.cpp | |
parent | 5167c1389b5b52ab68a40debebbace19d03554bf (diff) | |
download | bcm5719-llvm-372b1e796be6f4dbe872feed6beae27c5c9d4d26.tar.gz bcm5719-llvm-372b1e796be6f4dbe872feed6beae27c5c9d4d26.zip |
A "constexpr" is evaluated in a constant context. Make sure this is reflected
if a __builtin_constant_p() is a part of a constexpr.
llvm-svn: 347531
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 29508368d75..5eb2f2e7b84 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -10882,6 +10882,7 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx, ? EvalInfo::EM_ConstantExpression : EvalInfo::EM_ConstantFold); InitInfo.setEvaluatingDecl(VD, Value); + InitInfo.InConstantContext = true; LValue LVal; LVal.set(VD); @@ -11544,6 +11545,7 @@ bool Expr::isPotentialConstantExpr(const FunctionDecl *FD, EvalInfo Info(FD->getASTContext(), Status, EvalInfo::EM_PotentialConstantExpression); + Info.InConstantContext = true; const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD); const CXXRecordDecl *RD = MD ? MD->getParent()->getCanonicalDecl() : nullptr; |