I am banging my head around why the following leads to a compile error. I am a novice in meta programming but to my understanding of SFINAE principle the following functions are mutually exclusive hence it is not a 'redefinition' of an existing function.
#include <type_traits>
template<typename T>
using IsNotEnum = typename std::enable_if<!std::is_enum<T>::value>::type;
template<typename T>
using IsEnum = typename std::enable_if<std::is_enum<T>::value>::type;
template<typename T, typename = IsNotEnum<T>>
void doSomething()
{
}
template<typename T, typename = IsEnum<T>>
void doSomething()
{
}
g++ 7.5 complains with followings:
error: redefinition of ‘template<class T, class> void doSomething()’
void doSomething()
^~~~~~~~~~~
note: ‘template<class T, class> void doSomething()’ previously declared here
void doSomething()