diff options
| author | George Burgess IV <george.burgess.iv@gmail.com> | 2016-12-27 05:33:20 +0000 |
|---|---|---|
| committer | George Burgess IV <george.burgess.iv@gmail.com> | 2016-12-27 05:33:20 +0000 |
| commit | b531698ff0f3d85a225d26ee84714088dfd48636 (patch) | |
| tree | 095d430cd3667ce3c5f01a1beb394f5397b71e4e /clang/lib | |
| parent | 2da265b7bfb8430c90a5a24951dd3c1c1c45cbe3 (diff) | |
| download | bcm5719-llvm-b531698ff0f3d85a225d26ee84714088dfd48636.tar.gz bcm5719-llvm-b531698ff0f3d85a225d26ee84714088dfd48636.zip | |
Emit CCEDiags when evaluating a const variable.
This addresses post-review feedback from r290577.
llvm-svn: 290584
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index 2caaaab9ef2..b3f8925b646 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -2903,7 +2903,7 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E, // All the remaining cases only permit reading. Info.FFDiag(E, diag::note_constexpr_modify_global); return CompleteObject(); - } else if (VD->isConstexpr() || BaseType.isConstQualified()) { + } else if (VD->isConstexpr()) { // OK, we can read this variable. } else if (BaseType->isIntegralOrEnumerationType()) { // In OpenCL if a variable is in constant address space it is a const value. @@ -2928,6 +2928,9 @@ static CompleteObject findCompleteObject(EvalInfo &Info, const Expr *E, } else { Info.CCEDiag(E); } + } else if (BaseType.isConstQualified() && VD->hasDefinition(Info.Ctx)) { + Info.CCEDiag(E, diag::note_constexpr_ltor_non_constexpr) << VD; + // Keep evaluating to see what we can do. } else { // FIXME: Allow folding of values of any literal type in all languages. if (Info.checkingPotentialConstantExpression() && |

