forked from OSchip/llvm-project
Fix ambiguity detection in GetBestOverloadCandidateSimple.
When performing the simplistic overload resolution for single-argument methods, don't check the best overload for ambiguity with itself when the best overload doesn't happen to be the first one. Fixes PR13480. llvm-svn: 160961
This commit is contained in:
parent
355b660a4b
commit
bc7dd9ea02
|
@ -344,8 +344,8 @@ GetBestOverloadCandidateSimple(
|
|||
if (Cands[Best].second.compatiblyIncludes(Cands[I].second))
|
||||
Best = I;
|
||||
|
||||
for (unsigned I = 1; I != N; ++I)
|
||||
if (Cands[Best].second.compatiblyIncludes(Cands[I].second))
|
||||
for (unsigned I = 0; I != N; ++I)
|
||||
if (I != Best && Cands[Best].second.compatiblyIncludes(Cands[I].second))
|
||||
return 0;
|
||||
|
||||
return Cands[Best].first;
|
||||
|
|
|
@ -335,3 +335,14 @@ namespace NullPointerTemplateArg {
|
|||
X<(int*)0> x; // expected-warning {{use of null pointer as non-type template argument is incompatible with C++98}}
|
||||
Y<(int A::*)0> y; // expected-warning {{use of null pointer as non-type template argument is incompatible with C++98}}
|
||||
}
|
||||
|
||||
namespace PR13480 {
|
||||
struct basic_iterator {
|
||||
basic_iterator(const basic_iterator &it) {}
|
||||
basic_iterator(basic_iterator &it) {} // expected-note {{because type 'PR13480::basic_iterator' has a user-declared copy constructor}}
|
||||
};
|
||||
|
||||
union test {
|
||||
basic_iterator it; // expected-warning {{union member 'it' with a non-trivial copy constructor is incompatible with C++98}}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue