Candidate.Function = MethodTmpl->getTemplatedDecl();
Candidate.Viable = false;
Candidate.IsSurrogate = false;
- Candidate.IgnoreObjectArgument = false;
+ Candidate.IgnoreObjectArgument =
+ cast<CXXMethodDecl>(Candidate.Function)->isStatic() ||
+ ObjectType.isNull();
Candidate.ExplicitCallArguments = Args.size();
if (Result == TDK_NonDependentConversionFailure)
Candidate.FailureKind = ovl_fail_bad_conversion;
Candidate.Function = FunctionTemplate->getTemplatedDecl();
Candidate.Viable = false;
Candidate.IsSurrogate = false;
- Candidate.IgnoreObjectArgument = false;
+ // Ignore the object argument if there is one, since we don't have an object
+ // type.
+ Candidate.IgnoreObjectArgument =
+ isa<CXXMethodDecl>(Candidate.Function) &&
+ !isa<CXXConstructorDecl>(Candidate.Function);
Candidate.ExplicitCallArguments = Args.size();
if (Result == TDK_NonDependentConversionFailure)
Candidate.FailureKind = ovl_fail_bad_conversion;
void q() { p(X<int>(0), 0); } // expected-error {{no match}}
struct A {
- template <typename T> void f(T, void *, int = 0); // expected-note {{no known conversion from 'double' to 'void *' for 2nd argument}}
- void f(); // expected-note {{requires 0}}
+ template <typename T> void f(T, void *, int = 0); // expected-note 2{{no known conversion from 'double' to 'void *' for 2nd argument}}
+ void f(); // expected-note 2{{requires 0}}
+
+ template <typename T> static void g(T, void *, int = 0); // expected-note 2{{no known conversion from 'double' to 'void *' for 2nd argument}}
+ void g(); // expected-note 2{{requires 0}}
+
+ void h() {
+ f(1.0, 2.0); // expected-error {{no match}}
+ g(1.0, 2.0); // expected-error {{no match}}
+ }
};
- void f(A a) { a.f(1.0, 2.0); } // expected-error {{no match}}
+ void f(A a) {
+ a.f(1.0, 2.0); // expected-error {{no match}}
+ a.g(1.0, 2.0); // expected-error {{no match}}
+ }
}
namespace overload_vs_pack {