summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2014-11-14 22:09:15 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2014-11-14 22:09:15 +0000
commit5f951ee8bd723d5fcfeacf6d79b4ebf074069f85 (patch)
treeaa5abbcc170b2a7be5446a677f65d6483edc18c4 /clang/lib/Sema/SemaExprCXX.cpp
parentd38341e9425599d0d1e80310cd9da97e2da1d708 (diff)
downloadbcm5719-llvm-5f951ee8bd723d5fcfeacf6d79b4ebf074069f85.tar.gz
bcm5719-llvm-5f951ee8bd723d5fcfeacf6d79b4ebf074069f85.zip
Recommit r222044 with a test fix - it does not make sense to hunt
for a typedef before arithmetic conversion in all rare corner cases. llvm-svn: 222049
Diffstat (limited to 'clang/lib/Sema/SemaExprCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 88eb41ac448..26ffbfb58e3 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -4561,10 +4561,14 @@ QualType Sema::CXXCheckConditionalOperands(ExprResult &Cond, ExprResult &LHS,
// the usual arithmetic conversions are performed to bring them to a
// common type, and the result is of that type.
if (LTy->isArithmeticType() && RTy->isArithmeticType()) {
- UsualArithmeticConversions(LHS, RHS);
+ QualType ResTy = UsualArithmeticConversions(LHS, RHS);
if (LHS.isInvalid() || RHS.isInvalid())
return QualType();
- return LHS.get()->getType();
+
+ LHS = ImpCastExprToType(LHS.get(), ResTy, PrepareScalarCast(LHS, ResTy));
+ RHS = ImpCastExprToType(RHS.get(), ResTy, PrepareScalarCast(RHS, ResTy));
+
+ return ResTy;
}
// -- The second and third operands have pointer type, or one has pointer
OpenPOWER on IntegriCloud