diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2024-02-22 16:49:37 +0100 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2024-03-02 00:12:54 +0100 |
commit | 7068418a13c7149f81dade96000b99b1c37c0df8 (patch) | |
tree | b3a52682debbfb5cb8ff3ad481af84b54805c8a3 /tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp | |
parent | ee612626f99d5a8da6814c2df90db00f9beb463f (diff) |
QByteArray: use comparison helper macros
Replace the existing friend relational operators with the macros.
Add the previously-missing relational opertors with QChar and char16_t.
This allows to remove the last dummy relational operators and the
macros to generate them in tst_qstringapisymmetry.
Because of a bug in libstdc++[0], we have to explicitly keep the
QBA vs QBA relational operators even in C++20 mode. This problem is
specific to QByteArray, because it is convertible to const void *.
[0]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114153
Task-number: QTBUG-117661
Change-Id: Iac7f81cd3274331b7c7695a51803321b511361c0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp')
-rw-r--r-- | tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp index 33bfdf163a..e1a262b61a 100644 --- a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -32,7 +32,6 @@ struct QAnyStringViewUsingU16 : QAnyStringView {}; // QAnyStringView with Utf-1 template <typename T> QString toQString(const T &t) { return QString(t); } QString toQString(QStringView view) { return view.toString(); } -QString toQString(QUtf8StringView view) { return view.toString(); } template <typename Iterable> QStringList toQStringList(const Iterable &i) { @@ -45,29 +44,6 @@ QStringList toQStringList(const Iterable &i) { template <typename LHS, typename RHS> constexpr bool is_fake_comparator_v = false; -// FIXME: these are missing at the time of writing, add them, then remove the dummies here: -#define MAKE_RELOP(op, A1, A2) \ - static bool operator op (A1 lhs, A2 rhs) \ - { return toQString(lhs) op toQString(rhs); } \ - /*end*/ -#define MAKE_ALL(A1, A2) \ - template <> constexpr bool is_fake_comparator_v<A1, A2> = true; \ - MAKE_RELOP(==, A1, A2) \ - MAKE_RELOP(!=, A1, A2) \ - MAKE_RELOP(<, A1, A2) \ - MAKE_RELOP(>, A1, A2) \ - MAKE_RELOP(<=, A1, A2) \ - MAKE_RELOP(>=, A1, A2) \ - /*end*/ - - -MAKE_ALL(char16_t, QByteArray) -MAKE_ALL(QByteArray, char16_t) - -#undef MAKE_ALL -#undef MAKE_RELOP -// END FIXME - } // namespace static constexpr int sign(int i) noexcept |