What are the rules for the selection of overloaded function templates in case of non-type template parameters, if one of the parameters is a placeholder type. I am confused with the current behavior of the compilers, consider the next example:
template<int N> struct A{};
template<auto... N> void f(A<N...>);
template<int N> void f(A<N>) {}
template<auto N> void g(A<N>);
template<int N> void g(A<N>) {}
int main() {
f( A<1>{} ); // ok in GCC and Clang, error in MSVC
g( A<1>{} ); // ok in GCC, error in Clang and MSVC
}
Here MSVC fails to select between both sets of overloads. On the other hand, GCC always selects the function template with the more concrete type <int>. And Clang is somewhat in the middle, preferring <int> over the parameter pack <auto...>, but it sees ambiguity during selection between <int> and <auto> overloads. Online demo: https://gcc.godbolt.org/z/4EK99Gjhx
Which one of the behaviors is correct or the standard is not clear about it?