Why the following code does not generate an SFINAE error as got_empty will kick off many class instantiations which would fail because my_string does not have an empty function declared? It has something to do with the immediate context, but it is not clear why.
#include <type_traits>
struct my_string {
};
template <class T, class = std::void_t<>> struct got_empty : std::false_type {};
template <class T>
struct got_empty<T, std::enable_if_t<std::is_same_v<
std::invoke_result_t<decltype(&T::empty), T>, bool>>>
: std::true_type {};
static_assert(!got_empty<my_string>::value);