https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104691

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
N.B. this has nothing to do with SFINAE. The static_assert fails when the
template is first parsed *not* when instantiated. You can verify this easily:

template<typename T>
typename T::bar
f(T) { static_assert(false, ""); }

There is no SFINAE here, because there is no call and no substitution.

The relevant rule in the standard is:

The program is ill-formed, no diagnostic required, if:
— no valid specialization can be generated for a template or a substatement of
a constexpr if statement (8.5.2) within a template and the template is not
instantiated, or [...]

No valid specialization can ever be generated for that template. Every possible
set of template arguments will result in a failing static assert.

Reply via email to