I ran across a problem upgrading templated array references to std::array where I had used this:
template<class T, int N>
void f(T(&a)[N]){/* do stuff */;}
This has worked in all compilers I have used so I just did this when changing to std::array
template<class T, int N>
void f(std::array<T,N>& a){/* do stuff */;}
And this worked fine on MSVC. But when I ran the code on other compilers it did not
The following code works in MSVC but not other compilers. See https://godbolt.org/z/d9cqWMeaM which fails to match because N must be std::size_t.
*This question indicates that SFINAE should apply. However, as noted in the comments and in spite of the that answer, SFINAE, typically applies to rejection of malformed declarations. This is a deduction failure.
Is MSVC's acceptance of this code a compiler bug? And is the T(&a)[N] where int N was used legal even though all compilers I've ever used had no problem at all?
This was somewhat annoying because some of the prior code used the fact N was signed in various places.