[llvm-branch-commits] [cfe-branch] r292808 - Merging r292497:

Hans Wennborg via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Jan 23 09:59:45 PST 2017


Author: hans
Date: Mon Jan 23 11:59:45 2017
New Revision: 292808

URL: http://llvm.org/viewvc/llvm-project?rev=292808&view=rev
Log:
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

------------------------------------------------------------------------

Added:
    cfe/branches/release_40/test/Sema/PR28181.c
      - copied unchanged from r292497, cfe/trunk/test/Sema/PR28181.c
Modified:
    cfe/branches/release_40/   (props changed)
    cfe/branches/release_40/lib/Sema/SemaExpr.cpp

Propchange: cfe/branches/release_40/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jan 23 11:59:45 2017
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:291850,291853,291865,291871,291877,291879,291881,291907,291955,291964,292032,292052,292183,292247,292265,292555,292558-292559
+/cfe/trunk:291850,291853,291865,291871,291877,291879,291881,291907,291955,291964,292032,292052,292183,292247,292265,292497,292555,292558-292559
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_40/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_40/lib/Sema/SemaExpr.cpp?rev=292808&r1=292807&r2=292808&view=diff
==============================================================================
--- cfe/branches/release_40/lib/Sema/SemaExpr.cpp (original)
+++ cfe/branches/release_40/lib/Sema/SemaExpr.cpp Mon Jan 23 11:59:45 2017
@@ -11496,7 +11496,7 @@ ExprResult Sema::BuildBinOp(Scope *S, So
       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, So
     // 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);
 




More information about the llvm-branch-commits mailing list