libstdc++: Fix constraints on std::optional comparisons [PR 96269]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 5 Nov 2020 18:36:19 +0000 (18:36 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 5 Nov 2020 19:09:22 +0000 (19:09 +0000)
commitcdd2d448d8200ed5ebcb232163954367b553291e
tree513dc26b087c5b85ce1b2d58c07134bb11cb911a
parent10508db867934264bbc2578f1f454c19fa558fd3
libstdc++: Fix constraints on std::optional comparisons [PR 96269]

The relational operators for std::optional were using the wrong types
in the declval expressions used to constrain them. Instead of using
const lvalues they were using non-const rvalues, which meant that a type
might satisfy the constraints but then give an error when the function
body was instantiated.

libstdc++-v3/ChangeLog:

PR libstdc++/96269
* include/std/optional (operator==, operator!=, operator<)
(operator>, operator<=, operator>=): Fix types used in
SFINAE constraints.
* testsuite/20_util/optional/relops/96269.cc: New test.
libstdc++-v3/include/std/optional
libstdc++-v3/testsuite/20_util/optional/relops/96269.cc [new file with mode: 0644]