You cannot return an array from a function, so template creation is not performed, and there is no corresponding function.
You get this specific error due to SFINAE - This is not an error that the compiler cannot create your function, it is an error, there is no corresponding function.
You can return an array reference - T const & will be returned.
EDIT: in response to comments:
Firstly, this is really a worthy example of SFINAE.
template<typename T> T f(const T &item) { return item; } char const * f(void const * item) { return 0; } int main() { f("abc"); }
When the compiler compiles this, it will first try to instantiate the template f to create an exact match for the type const char [3] . Due to these reasons, this fails. Then he selects an inaccurate match, the usual function, and when you turn the call const char [3] - a const char * .
source share