https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121053
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Neither form is constrained in the standard. With libstdc++ std::visit is SFINAE-friendly and std::visit<R> is not. With libc++ both are SFINAE-friendly.