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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160961
91177308-0d34-0410-b5e6-
96231b3b80d8
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;
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}}
+ };
+}