diff options
author | Hans Wennborg <hans@hanshq.net> | 2017-01-23 17:59:45 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2017-01-23 17:59:45 +0000 |
commit | 12c394c7d933abb7e76c60977d611052f11bf600 (patch) | |
tree | d21ca82f7c80ea1b92263108b1e7df6b0b152139 /lib | |
parent | 6a36a695bab036e07052f471fd96d15042f0a7ed (diff) |
Merging r292497:
------------------------------------------------------------------------
r292497 | arphaman | 2017-01-19 09:17:57 -0800 (Thu, 19 Jan 2017) | 6 lines
[Sema] Fix PR28181 by avoiding calling BuildOverloadedBinOp in C mode
rdar://28532840
Differential Revision: https://reviews.llvm.org/D25213
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_40@292808 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaExpr.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index d62e8fd68b..e1e1f02836 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -11496,7 +11496,7 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc, return checkPseudoObjectAssignment(S, OpLoc, Opc, LHSExpr, RHSExpr); // Don't resolve overloads if the other type is overloadable. - if (pty->getKind() == BuiltinType::Overload) { + if (getLangOpts().CPlusPlus && pty->getKind() == BuiltinType::Overload) { // We can't actually test that if we still have a placeholder, // though. Fortunately, none of the exceptions we see in that // code below are valid when the LHS is an overload set. Note @@ -11521,17 +11521,16 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc, // An overload in the RHS can potentially be resolved by the type // being assigned to. if (Opc == BO_Assign && pty->getKind() == BuiltinType::Overload) { - if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent()) - return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr); - - if (LHSExpr->getType()->isOverloadableType()) + if (getLangOpts().CPlusPlus && + (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent() || + LHSExpr->getType()->isOverloadableType())) return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr); return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr); } // Don't resolve overloads if the other type is overloadable. - if (pty->getKind() == BuiltinType::Overload && + if (getLangOpts().CPlusPlus && pty->getKind() == BuiltinType::Overload && LHSExpr->getType()->isOverloadableType()) return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr); |