diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2016-02-23 18:55:15 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2016-02-23 18:55:15 +0000 |
commit | 558995c9671d094a1e405084a181c9eddab04ec8 (patch) | |
tree | e8f0cb8be1ceb79c57ef3e634d7fb87dae434127 /clang/lib/Sema/SemaExpr.cpp | |
parent | f7ae359d2c8ab309a1556a4365c52fab26281e3c (diff) | |
download | bcm5719-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.cpp | 11 |
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. |