diff options
| author | John McCall <rjmccall@apple.com> | 2010-02-25 10:46:05 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-02-25 10:46:05 +0000 |
| commit | 21b57fa4e5f1b6ec663e8a10d143b3086b93a6d3 (patch) | |
| tree | f50e0bfe6c8b90d8e833af590156634478b8b710 | |
| parent | b306bcc266a7ee2313b12f8d78af7c03b76dba7a (diff) | |
| download | bcm5719-llvm-21b57fa4e5f1b6ec663e8a10d143b3086b93a6d3.tar.gz bcm5719-llvm-21b57fa4e5f1b6ec663e8a10d143b3086b93a6d3.zip | |
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.
llvm-svn: 97135
| -rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 3 | ||||
| -rw-r--r-- | clang/test/SemaCXX/overload-call.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 7208b90939a..cfb4b919962 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -4797,7 +4797,8 @@ struct CompareOverloadCandidatesForDisplay { 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: diff --git a/clang/test/SemaCXX/overload-call.cpp b/clang/test/SemaCXX/overload-call.cpp index 21b5da21d8f..38a26d38ca3 100644 --- a/clang/test/SemaCXX/overload-call.cpp +++ b/clang/test/SemaCXX/overload-call.cpp @@ -360,12 +360,13 @@ namespace DerivedToBaseVsVoid { } } -// 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}} |

