summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExpr.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2016-02-23 18:55:15 +0000
committerAaron Ballman <aaron@aaronballman.com>2016-02-23 18:55:15 +0000
commit558995c9671d094a1e405084a181c9eddab04ec8 (patch)
treee8f0cb8be1ceb79c57ef3e634d7fb87dae434127 /clang/lib/Sema/SemaExpr.cpp
parentf7ae359d2c8ab309a1556a4365c52fab26281e3c (diff)
downloadbcm5719-llvm-558995c9671d094a1e405084a181c9eddab04ec8.tar.gz
bcm5719-llvm-558995c9671d094a1e405084a181c9eddab04ec8.zip
Amends r252104 to evaluate the controlling expression in an unevaluated context. This eliminates false-positive diagnostics about null pointer dereferences (etc) in the controlling expression.
llvm-svn: 261669
Diffstat (limited to 'clang/lib/Sema/SemaExpr.cpp')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index bfbca298ce8..ee9e646e24c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1373,10 +1373,13 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc,
// Decay and strip qualifiers for the controlling expression type, and handle
// placeholder type replacement. See committee discussion from WG14 DR423.
- ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
- if (R.isInvalid())
- return ExprError();
- ControllingExpr = R.get();
+ {
+ EnterExpressionEvaluationContext Unevaluated(*this, Sema::Unevaluated);
+ ExprResult R = DefaultFunctionArrayLvalueConversion(ControllingExpr);
+ if (R.isInvalid())
+ return ExprError();
+ ControllingExpr = R.get();
+ }
// The controlling expression is an unevaluated operand, so side effects are
// likely unintended.
OpenPOWER on IntegriCloud