summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorEli Friedman <efriedma@quicinc.com>2019-02-09 02:22:17 +0000
committerEli Friedman <efriedma@quicinc.com>2019-02-09 02:22:17 +0000
commit041adb0ed0bf937e6e638781dfca41e42a3f0af4 (patch)
tree48775783c677f5c3cc029fa8c4b974249459687e /clang/lib/AST/ExprConstant.cpp
parent8c2a2363587bf77bedb160e704a9030769a3799c (diff)
downloadbcm5719-llvm-041adb0ed0bf937e6e638781dfca41e42a3f0af4.tar.gz
bcm5719-llvm-041adb0ed0bf937e6e638781dfca41e42a3f0af4.zip
Fix buildbot failure from r353569.
I assumed lvalue-to-rvalue conversions of array type would never happen, but apparently clang-tidy tries in some cases. llvm-svn: 353598
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index 801ee968395..19e6b53b09e 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -3370,8 +3370,15 @@ static bool handleLValueToRValueConversion(EvalInfo &Info, const Expr *Conv,
} else if (isa<StringLiteral>(Base) || isa<PredefinedExpr>(Base)) {
// Special-case character extraction so we don't have to construct an
// APValue for the whole string.
- assert(LVal.Designator.Entries.size() == 1 &&
+ assert(LVal.Designator.Entries.size() <= 1 &&
"Can only read characters from string literals");
+ if (LVal.Designator.Entries.empty()) {
+ // Fail for now for LValue to RValue conversion of an array.
+ // (This shouldn't show up in C/C++, but it could be triggered by a
+ // weird EvaluateAsRValue call from a tool.)
+ Info.FFDiag(Conv);
+ return false;
+ }
if (LVal.Designator.isOnePastTheEnd()) {
if (Info.getLangOpts().CPlusPlus11)
Info.FFDiag(Conv, diag::note_constexpr_access_past_end) << AK_Read;
OpenPOWER on IntegriCloud