Skip to content

Commit

Permalink
tst_QStringApiSymmetry: test QByteArray(weak)/QByteArrayView overloading
Browse files Browse the repository at this point in the history
Adding it here since this test case already has all the infrastructure
for the overload test.

Pick-to: 6.5
Change-Id: I2d7fff9d2d82fed3db2446690a354f939c9a37fc
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
(cherry picked from commit 140dac9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 29e2695)
  • Loading branch information
marcmutz authored and Qt Cherry-pick Bot committed Dec 13, 2024
1 parent 34dfd7e commit 6eef35a
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1198,6 +1198,10 @@ Q_WEAK_OVERLOAD
auto overload_s_bav(const QString &s) { return s; }
auto overload_s_bav(QByteArrayView s) { return s; }

Q_WEAK_OVERLOAD
auto overload_ba_bav(const QByteArray &s) { return s; }
auto overload_ba_bav(QByteArrayView s) { return s; }

} // unnamed namespace

template<typename T>
Expand Down Expand Up @@ -1269,6 +1273,15 @@ void tst_QStringApiSymmetry::overload()
overload_s_bav(CT());
}
}

if constexpr (std::is_convertible_v<T, QByteArray> || std::is_convertible_v<T, QByteArrayView>) {
overload_ba_bav(t);
overload_ba_bav(ct);
if constexpr (!std::is_array_v<T>) {
overload_ba_bav(T());
overload_ba_bav(CT());
}
}
QT_WARNING_POP
}

Expand Down

0 comments on commit 6eef35a

Please sign in to comment.