summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2024-05-22 13:43:44 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2024-05-22 23:37:11 +0000
commit1b076b3027e0e059ba37fc9332c65e6354516a95 (patch)
tree1714feaa1351e69b4608f75113855d5301957746
parenttst_QByteArrayView: expose constExpr() test to non-ubsan GCC builds (diff)
downloadqtbase-1b076b3027e0e059ba37fc9332c65e6354516a95.tar.xz
qtbase-1b076b3027e0e059ba37fc9332c65e6354516a95.zip
tst_QByteArrayView: (re)fix GCC ubsan build
Move the constexpr fromArray() check from fromArray() to constExpr() where there is already the protection necessary to work around https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71962. Amends bbe7570ddcc6fcce707a355b76d2d0024c44ea38(!). (iow: 6.0, and no, I don't know why it became a problem only now) Pick-to: 6.5 6.2 Change-Id: Id9d2a08175709f8bf85b3b192e7aa49783b9e714 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit 6d28744e43c113b0f94b2132d5904d85a18d81a3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--tests/auto/corelib/text/qbytearrayview/tst_qbytearrayview.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/auto/corelib/text/qbytearrayview/tst_qbytearrayview.cpp b/tests/auto/corelib/text/qbytearrayview/tst_qbytearrayview.cpp
index 5cfce32586..001668691d 100644
--- a/tests/auto/corelib/text/qbytearrayview/tst_qbytearrayview.cpp
+++ b/tests/auto/corelib/text/qbytearrayview/tst_qbytearrayview.cpp
@@ -306,6 +306,9 @@ void tst_QByteArrayView::constExpr() const
static_assert(bv.back() == 'o');
static_assert(bv.last() == 'o');
+ constexpr auto bv2 = QByteArrayView::fromArray(hello);
+ QCOMPARE_EQ(bv, bv2);
+
constexpr std::string_view sv = bv;
static_assert(bv.size() == sv.size());
#ifdef AMBIGUOUS_CALL // QTBUG-108805
@@ -383,7 +386,7 @@ void tst_QByteArrayView::fromArray() const
{
static constexpr char hello[] = "Hello\0abc\0\0.";
- constexpr QByteArrayView bv = QByteArrayView::fromArray(hello);
+ const QByteArrayView bv = QByteArrayView::fromArray(hello);
QCOMPARE(bv.size(), 13);
QVERIFY(!bv.empty());
QVERIFY(!bv.isEmpty());