#include <type_traits>
template<bool b>
struct S
{
template<typename = std::enable_if_t<b>>
S() {}
template<typename = std::enable_if_t<!b>>
S(int) {}
};
S<true> s{}; // error in clang/gcc, OK in VC2017
S<false> s{0}; // error in clang/gcc, OK in VC2017
In both cases clang/gcc try to instantiate the ctor that should actually be discarded due to SFINAE. The error message is:
error : no type named 'type' in 'std::enable_if< false, void>'; 'enable_if' cannot be used to disable this declaration
clang/gcc's instantiation of the other ctor is incorrect since it should not be on the list of possible overloads, right?
But before I file a bug I would like to read what others think. Maybe I don't get it right...