diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2021-06-07 13:02:15 +0100 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2021-06-07 15:45:14 +0100 |
commit | adec14811714e22a6c1f7f0199adc05370f0d8b0 (patch) | |
tree | acb3e4c20ae53a19daa2b81b7d86e2b619b934d1 /gcc/bitmap.h | |
parent | f0d1a675e0f621fc12c7a9db47446ae38289408a (diff) | |
download | gcc-adec14811714e22a6c1f7f0199adc05370f0d8b0.zip gcc-adec14811714e22a6c1f7f0199adc05370f0d8b0.tar.gz gcc-adec14811714e22a6c1f7f0199adc05370f0d8b0.tar.bz2 |
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.
Diffstat (limited to 'gcc/bitmap.h')
0 files changed, 0 insertions, 0 deletions