https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119343
Bug ID: 119343
Summary: No SFINAE for deleted explicit specializations
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: herring at lanl dot gov
Target Milestone: ---
GCC trunk produces a hard error instead of SFINAE for the explicit
specialization in the example below <https://godbolt.org/z/4ovcrhbnG>. f is
included for comparison; every compiler (except perhaps NVC++) does something
different here, but I don't see any reason why SFINAE wouldn't apply in both
cases.
#include<type_traits>
struct X {
static void f()=delete;
template<int> static void g();
};
template<> void X::g<0>()=delete;
struct Y {
static void f();
template<int> static void g();
};
template<class T,class=void>
struct has_f : std::false_type {};
template<class T>
struct has_f<T,decltype(void(T::f))> : std::true_type {};
static_assert(!has_f<X>::value);
static_assert(has_f<Y>::value);
template<class T,class=void>
struct has_g0 : std::false_type {};
template<class T>
struct has_g0<T,decltype(void(T::template g<0>))> : std::true_type {};
static_assert(!has_g0<X>::value);
static_assert(has_g0<Y>::value);