Note that you don't have a templated function, Max. One returns nothing. One returns something.
You have a syntax error in the first line, so the explicit specialization of the non-existent templated function is, of course, something for the compiler to complain about if it happens to get that far.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <iostream>
#include <cstring>
// templated function:
template<typename T>
T Max(T a, T b) { return a > b ? a : b; }
// explicit specialization of templated function:
template <>
constchar* Max(constchar* a, constchar* b) {
return std::strcmp(a, b) > 0 ? a : b;
}
int main() {
constchar* b = "b";
constchar* a = "a";
std::cout << Max(a, b) << '\n';
}