gcc/libstdc++-v3/testsuite/20_util/optional/relops
Jonathan Wakely adec148117 libstdc++: Constrain three-way comparison for std::optional [PR 98842]
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.
2021-06-07 15:45:14 +01:00
..
1.cc libstdc++: Remove redundant -std=gnu++17 option from any/optional/variant tests 2021-05-10 16:22:53 +01:00
2.cc libstdc++: Remove redundant -std=gnu++17 option from any/optional/variant tests 2021-05-10 16:22:53 +01:00
3.cc libstdc++: Remove redundant -std=gnu++17 option from any/optional/variant tests 2021-05-10 16:22:53 +01:00
4.cc libstdc++: Remove redundant -std=gnu++17 option from any/optional/variant tests 2021-05-10 16:22:53 +01:00
5.cc libstdc++: Remove redundant -std=gnu++17 option from any/optional/variant tests 2021-05-10 16:22:53 +01:00
6.cc libstdc++: Remove redundant -std=gnu++17 option from any/optional/variant tests 2021-05-10 16:22:53 +01:00
7.cc libstdc++: Remove redundant -std=gnu++17 option from any/optional/variant tests 2021-05-10 16:22:53 +01:00
96269.cc Update copyright years. 2021-01-04 10:26:59 +01:00
three_way.cc libstdc++: Constrain three-way comparison for std::optional [PR 98842] 2021-06-07 15:45:14 +01:00