[Bug libstdc++/106589] [12 Regression] visit<void> rejects lambdas that do not return void

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Aug 24 13:01:39 GMT 2022


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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:219d9f61a241d370b7933aecae56ce0905465830

commit r12-8711-g219d9f61a241d370b7933aecae56ce0905465830
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 23 15:46:16 2022 +0100

    libstdc++: Fix visit<void>(v) for non-void visitors [PR106589]

    The optimization for the common case of std::visit forgot to handle the
    edge case of passing zero variants to a non-void visitor and converting
    the result to void.

    libstdc++-v3/ChangeLog:

            PR libstdc++/106589
            * include/std/variant (__do_visit): Handle is_void<R> for zero
            argument case.
            * testsuite/20_util/variant/visit_r.cc: Check std::visit<void>(v).

    (cherry picked from commit e85bb1881e57e53306ede2a15f30d06480d69886)


More information about the Gcc-bugs mailing list