https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113110
--- Comment #3 from Jason Liam <jlame646 at gmail dot com> --- (In reply to Andrew Pinski from comment #1) > I suspect this is either a bug or an extension for MSVC. 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 This indicates that gcc was wrong in rejecting the original code. For reference here is the modified code which starts compiling with gcc: ``` template <size_t N, size_t M> int compare(const char (&a)[N], const char (&b)[M]) { return strcmp(a, b); } //--------------------vvvvvvvvvv-------->added this parameter template <typename T, typename U> //----------------------------v--------->changed this to U int compare(const T &a, const U &b) { if (a < b) return -1; if (b < a) return 1; return 0; } int main() { compare("dog", "cat"); //now gcc also accepts it } ```