https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91371
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Jonathan Wakely from comment #5) > template<typename T, bool = __is_class(T) || __is_union(T), typename = void> This needs to exclude pointers as well as class types, because ... > struct is_referenceable_function : false_type { }; > > template<typename T> > struct is_referenceable_function<T, false, > __void_t<decltype(static_cast<T*>(std::declval<T&>()))>> This static cast does an explicit conversion, which is allowed from X*& to X**. The other alternative would be to test for implicit conversion, not explicit.