// PR c++/12672 // Verify we don't substitute explicit template arguments into // candidate function templates when the arity of the function // template disagrees with the arity of the call. template struct A { typedef typename T::type type; }; template void f(T); // arity 1 template void f(T, T, T); // arity 3 template typename A::type f(T, T); // arity 2 template typename A::type f(U, U); // arity 2 struct B { template void f(T); // arity 1 template void f(T, T, T); // arity 3 template typename A::type f(T, T); // arity 2 template typename A::type f(U, U); // arity 2 }; int main() { // If overload resolution attempts deduction for any of the arity-2 function // templates, the substitution of explicit arguments into the template would // cause a hard error. f(1); f(1, 1, 1); B b; b.f(1); b.f(1, 1, 1); }