https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113110
Harald van Dijk <harald at gigawatt dot nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |harald at gigawatt dot nl --- Comment #6 from Harald van Dijk <harald at gigawatt dot nl> --- (In reply to Jason Liam from comment #3) > Are you sure? I mean if you add another template parameter `U` to the second > parameter and use it then gcc starts accepting the code and using the more > specialized version. Demo:https://godbolt.org/z/W7Ma6c5Ts In order to determine whether int compare(const char (&)[N], const char (&)[M]) is more specialised than int compare(const T &, const T &), template argument deduction is attempted to solve one in terms of the other. Solving gives T = char[N] for the first parameter, but T = char[M] for the second parameter. This is a conflict that is ignored by MSVC. When adding the second template parameter `U`, solving gives T = char[N], and U = char[M]. This is never a conflict, this unambiguously makes the array version more specialised. (In reply to Andrew Pinski from comment #5) > I am still suspecting MSVC of not implementing the C++ Defect report 214 . At first glance, both GCC/clang and MSVC behaviour look like legitimate but different interpretations of DR 214. Whether MSVC is right to ignore that conflict is an open question covered by https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2160.