https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111004
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Component|c++ |libstdc++ Status|UNCONFIRMED |NEW Last reconfirmed| |2023-08-13 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- The static assert message for libc++ does say why, but not in user friendly language. I think we could change libstdc++ to use decltype(auto) for the return type of visit, and then use a nice static assert (with better message) to diagnose the invalid cases. We currently constrain the function using SFINAE, which isn't actually required by the standard, and makes it harder to give a good error here.