The sub-statement of a case statement is not an unevaluated context!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89303 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h
index 2bee32a..ca680c2 100644
--- a/lib/Sema/TreeTransform.h
+++ b/lib/Sema/TreeTransform.h
@@ -3037,18 +3037,21 @@
template<typename Derived>
Sema::OwningStmtResult
TreeTransform<Derived>::TransformCaseStmt(CaseStmt *S) {
- // The case value expressions are not potentially evaluated.
- EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
+ OwningExprResult LHS(SemaRef), RHS(SemaRef);
+ {
+ // The case value expressions are not potentially evaluated.
+ EnterExpressionEvaluationContext Unevaluated(SemaRef, Action::Unevaluated);
- // Transform the left-hand case value.
- OwningExprResult LHS = getDerived().TransformExpr(S->getLHS());
- if (LHS.isInvalid())
- return SemaRef.StmtError();
+ // Transform the left-hand case value.
+ LHS = getDerived().TransformExpr(S->getLHS());
+ if (LHS.isInvalid())
+ return SemaRef.StmtError();
- // Transform the right-hand case value (for the GNU case-range extension).
- OwningExprResult RHS = getDerived().TransformExpr(S->getRHS());
- if (RHS.isInvalid())
- return SemaRef.StmtError();
+ // Transform the right-hand case value (for the GNU case-range extension).
+ RHS = getDerived().TransformExpr(S->getRHS());
+ if (RHS.isInvalid())
+ return SemaRef.StmtError();
+ }
// Build the case statement.
// Case statements are always rebuilt so that they will attached to their