mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-26 12:35:05 +08:00
adec148117
The operator<=>(const optional<T>&, const U&) operator is supposed to be constrained with three_way_comparable_with<U, T> so that it can only be used when T and U are weakly-equality-comparable and also three-way comparable. Adding that constrain completely breaks std::optional comparisons, because it causes constraint recursion. To avoid that, an additional check that U is not a specialization of std::optional is needed. That appears to be a defect in the standard and should be reported to LWG. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: PR libstdc++/98842 * include/std/optional (operator<=>(const optional<T>& const U&)): Add missing constraint and add workaround for template recursion. * testsuite/20_util/optional/relops/three_way.cc: Check that type without equality comparison cannot be compared when wrapped in std::optional. |
||
---|---|---|
.. | ||
1.cc | ||
2.cc | ||
3.cc | ||
4.cc | ||
5.cc | ||
6.cc | ||
7.cc | ||
96269.cc | ||
three_way.cc |