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.7 6.5 6.2 Change-Id: Id9d2a08175709f8bf85b3b192e7aa49783b9e714 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
564be117fe
commit
6d28744e43
@ -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
|
||||
@ -415,7 +418,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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user