From 5f951ee8bd723d5fcfeacf6d79b4ebf074069f85 Mon Sep 17 00:00:00 2001 From: Anton Korobeynikov Date: Fri, 14 Nov 2014 22:09:15 +0000 Subject: 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 --- clang/lib/Sema/SemaExprCXX.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'clang/lib/Sema/SemaExprCXX.cpp') 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 -- cgit v1.2.3