https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85809
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |RESOLVED Resolution|--- |FIXED Target Milestone|--- |9.0 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Fixed in GCC 9.0. In file included from <source>:1: /opt/compiler-explorer/gcc-9.1.0/include/c++/9.1.0/type_traits: In substitution of 'template<bool _Cond, class _Tp> using enable_if_t = typename std::enable_if::type [with bool _Cond = (0 == 1); _Tp = float]': <source>:20:10: required from 'class MyClass<FOO>' <source>:27:26: required from here /opt/compiler-explorer/gcc-9.1.0/include/c++/9.1.0/type_traits:2426:11: error: no type named 'type' in 'struct std::enable_if<false, float>' 2426 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ ASM generation compiler returned: 1 ------------------------- The original testcase: #include <type_traits> enum MyEnum { FOO, BAR }; template <MyEnum E> void do_stuff(std::enable_if_t<E == FOO, float> a) { /*do foo logic*/ } template <MyEnum E> void do_stuff(std::enable_if_t<E == BAR, float> a) { /*do bar logic*/ } template <MyEnum E> class MyClass { public: void go(std::enable_if_t<E == MyEnum::FOO, int>) {} void go(std::enable_if_t<E == MyEnum::BAR, float>) {} }; int main() { do_stuff<MyEnum::BAR>(2.f); // Comment this line out and it doesn't compile anymore. MyClass<MyEnum::FOO> q; q.go(1); }