Not completely tested yet. This does fix the problem of converting incompatible pointer-to-function types, and thus gets rid of the suggestion that compiling the code with -fpermissive is a possibility. There is a special-casing for visit() for visitation of a single variant, and there we don't even instantiate the whole table mechanism. We should really entertain the possibility of flattening the whole visitation table; then this check could (at least in theory) be uniformly written as just an iteration of all table elements, which is not so convenient to do with the nested multitable. This seems like a worthy incremental improvement to me. 2020-09-29 Ville Voutilainen PR libstdc++/95904 * include/std/variant (__same_types): New. (__check_visitor_result): Likewise. (__check_visitor_results): Likewise. (visit(_Visitor&&, _Variants&&...)): Use __check_visitor_results in case we're visiting just one variant. (__gen_vtable_impl::_S_apply): Check the visitor return type.