[cfe-commits] r97135 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/SemaCXX/overload-call.cpp

John McCall rjmccall at apple.com
Thu Feb 25 02:46:06 PST 2010


Author: rjmccall
Date: Thu Feb 25 04:46:05 2010
New Revision: 97135

URL: http://llvm.org/viewvc/llvm-project?rev=97135&view=rev
Log:
When comparing two method overload candidates during overload diagnostics,
skip the object argument conversion if either of the candidates didn't
initialize it.

Fixes PR6421, which is such a very straightforward extension of PR6398 that I
should have worked it into the last test case (and therefore caught it then).
Ah well.


Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/SemaCXX/overload-call.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=97135&r1=97134&r2=97135&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Feb 25 04:46:05 2010
@@ -4797,7 +4797,8 @@
         assert(L->Conversions.size() == R->Conversions.size());
 
         int leftBetter = 0;
-        for (unsigned I = 0, E = L->Conversions.size(); I != E; ++I) {
+        unsigned I = (L->IgnoreObjectArgument || R->IgnoreObjectArgument);
+        for (unsigned E = L->Conversions.size(); I != E; ++I) {
           switch (S.CompareImplicitConversionSequences(L->Conversions[I],
                                                        R->Conversions[I])) {
           case ImplicitConversionSequence::Better:

Modified: cfe/trunk/test/SemaCXX/overload-call.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/overload-call.cpp?rev=97135&r1=97134&r2=97135&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/overload-call.cpp (original)
+++ cfe/trunk/test/SemaCXX/overload-call.cpp Thu Feb 25 04:46:05 2010
@@ -360,12 +360,13 @@
   }
 }
 
-// PR 6398
+// PR 6398 + PR 6421
 namespace test4 {
   class A;
   class B {
     static void foo(); // expected-note {{not viable}}
     static void foo(int*); // expected-note {{not viable}}
+    static void foo(long*); // expected-note {{not viable}}
 
     void bar(A *a) { 
       foo(a); // expected-error {{no matching function for call}}





More information about the cfe-commits mailing list