libstdc++: Ensure std::variant relops convert to bool [PR115145]
commitb33f44ca6ce2dae7502ce138600e1631ffc9232c
authorJonathan Wakely <jwakely@redhat.com>
Tue, 21 May 2024 14:13:01 +0000 (21 15:13 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 22 May 2024 08:43:41 +0000 (22 09:43 +0100)
tree9de4e86fc629e5e709cc7df148e23bbcd0322c9f
parent424f8a01df9b311250e416759ad61c00bba4af48
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.
libstdc++-v3/include/std/variant
libstdc++-v3/testsuite/20_util/variant/relops/115145.cc [new file with mode: 0644]