]> granicus.if.org Git - clang/commitdiff
Correctly resolve an overload set passed to an overloaded operator=. PR11784.
authorEli Friedman <eli.friedman@gmail.com>
Tue, 17 Jan 2012 21:27:43 +0000 (21:27 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Tue, 17 Jan 2012 21:27:43 +0000 (21:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148335 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/SemaCXX/overloaded-operator.cpp

index 26ca3a9cc012e151e1e79bd73e425d8378f96437..33c8a83b40f5b4d4e7d2c3d32fc0a17f6604f723 100644 (file)
@@ -8159,6 +8159,9 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc,
       if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent())
         return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr);
 
+      if (LHSExpr->getType()->isOverloadableType())
+        return BuildOverloadedBinOp(*this, S, OpLoc, Opc, LHSExpr, RHSExpr);
+
       return CreateBuiltinBinOp(OpLoc, Opc, LHSExpr, RHSExpr);
     }
 
index 2c9dff3ef900526d6f60e491e533366c6ada39b0..8ecb54dde6dabce39a5d3ea11dcf2118e58120ac 100644 (file)
@@ -408,3 +408,10 @@ class StringRef {
 };
 
 }
+
+namespace PR11784 {
+  struct A { A& operator=(void (*x)()); };
+  void f();
+  void f(int);
+  void g() { A x; x = f; }
+}