https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115145
--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:b33f44ca6ce2dae7502ce138600e1631ffc9232c commit r15-769-gb33f44ca6ce2dae7502ce138600e1631ffc9232c Author: Jonathan Wakely <jwak...@redhat.com> Date: Tue May 21 15:13:01 2024 +0100 libstdc++: Ensure std::variant relops convert to bool [PR115145] Ensure that the result of comparing the variant alternatives is converted to bool immediately rather than copied. libstdc++-v3/ChangeLog: PR libstdc++/115145 * include/std/variant (operator==, operator!=, operator<) (operator<=, operator>, operator>=): Add trailing-return-type to lambda expressions to trigger conversion to bool. * testsuite/20_util/variant/relops/115145.cc: New test.