diff options
| author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-06-21 20:58:56 +0200 |
|---|---|---|
| committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2024-07-23 01:51:21 +0200 |
| commit | b892b39a7a6c50eb5bbf03f0c9f01bdd07756f13 (patch) | |
| tree | 70f3b0123d78732925e179d1fa1a38eaa9034959 /src/corelib/io/qdebug.cpp | |
| parent | df3c9f365f9543ec6491354f11103280ded0f3a9 (diff) | |
QCompare: add more relational operator overloads
libc++ has a "poisoned" set of relational operator overloads for
the standard category types. A call like
std::strong_ordering::equivalent == Qt::partial_ordering::equivalent
fails to compile, despite the presence of
operator==(std::partial_ordering, Qt::partial_ordering)
This is viable after converting strong_ordering. But strong_ordering
itself defines a
operator==(std::strong_ordering, CmpZero)
where CmpZero is poisoned and accepts Qt::partial_ordering, making
the call ill-formed.
I'm not 100% sure if libc++ is right here (cf. the linked upstream
bug report for some ruminations). We can work around this issue by
adding sufficient additional overloads to Qt::partial_ordering and
be a perfect match. For some reason this was already the case for
the other Qt's comparison types.
Notes:
1) I didn't test this. Only libc++-trunk defined the necessary C++
feature macros to trigger the problem; I made a synthetic testcase
and it worked.
2) I'm not sure why these operators are defined symmetrically instead of
relying on C++20's reversed operators, but I'll follow the
pre-existing ones.
Change-Id: I0937f40b7e685026d4677e7918948d47d2b7cec6
Pick-to: 6.8 6.7
Fixes: QTBUG-126541
Task-number: QTQAINFRA-6203
Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io>
Reviewed-by: Khem Raj <raj.khem@gmail.com>
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Diffstat (limited to 'src/corelib/io/qdebug.cpp')
0 files changed, 0 insertions, 0 deletions
