summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaExprCXX.cpp
diff options
context:
space:
mode:
authorAnton Korobeynikov <asl@math.spbu.ru>2014-11-14 21:41:07 +0000
committerAnton Korobeynikov <asl@math.spbu.ru>2014-11-14 21:41:07 +0000
commitdc12b367bc175ad5af56f4701a2ffb43a18db779 (patch)
tree71225dcb531f8f5a7d96ffeef02f8ffd1ee6c9b7 /clang/lib/Sema/SemaExprCXX.cpp
parent71aa1a9355d80ac3c9579a1277f07fd7b2a609f2 (diff)
downloadbcm5719-llvm-dc12b367bc175ad5af56f4701a2ffb43a18db779.tar.gz
bcm5719-llvm-dc12b367bc175ad5af56f4701a2ffb43a18db779.zip
Follow-up to D6217
Summary: Ok, here is somewhat addition to D6217 aiming to preserve old darwin behavior wrt the typedefed types. The actual change to SemaChecking turned out to be pretty gross, in particular: 1. We need to extract the typedef'ed type for proper diagnostics 2. We need to walk over paren expressions as well Reviewers: chandlerc, rsmith Reviewed By: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D6256 llvm-svn: 222044
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