summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2011-10-27 22:11:44 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2011-10-27 22:11:44 +0000
commit08b12f1f5e4619a2cf2e192a2db9e274995a80aa (patch)
treef1131badc103db2fead4218280f68de63462bf1b /clang/lib/Sema/SemaStmt.cpp
parente889ad65ccc07708af91cc17038604ddd3326aa0 (diff)
downloadbcm5719-llvm-08b12f1f5e4619a2cf2e192a2db9e274995a80aa.tar.gz
bcm5719-llvm-08b12f1f5e4619a2cf2e192a2db9e274995a80aa.zip
Fix some cases where a CK_IntegralCast was being used to convert an lvalue to an
rvalue. An assertion to catch this is in ImpCastExprToType will follow, but vector operations currently trip over this (due to omitting the usual arithmetic conversions). Also add an assert to catch missing lvalue-to-rvalue conversions on the LHS of ->. llvm-svn: 143155
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index f35b359f57e..6dcfbbab847 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -639,6 +639,9 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
// If the LHS is not the same type as the condition, insert an implicit
// cast.
+ // FIXME: In C++11, the value is a converted constant expression of the
+ // promoted type of the switch condition.
+ Lo = DefaultLvalueConversion(Lo).take();
Lo = ImpCastExprToType(Lo, CondType, CK_IntegralCast).take();
CS->setLHS(Lo);
@@ -716,8 +719,11 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch,
Hi->getLocStart(),
diag::warn_case_value_overflow);
- // If the LHS is not the same type as the condition, insert an implicit
+ // If the RHS is not the same type as the condition, insert an implicit
// cast.
+ // FIXME: In C++11, the value is a converted constant expression of the
+ // promoted type of the switch condition.
+ Hi = DefaultLvalueConversion(Hi).take();
Hi = ImpCastExprToType(Hi, CondType, CK_IntegralCast).take();
CR->setRHS(Hi);
OpenPOWER on IntegriCloud