diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index d8dbe65b05c..c34a2b6f4e4 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -259,6 +259,7 @@ class QVarLengthArray friend class QVarLengthArray; using Base = QVLABase; using Storage = QVLAStorage; + static_assert(Prealloc > 0, "QVarLengthArray Prealloc must be greater than 0."); static_assert(std::is_nothrow_destructible_v, "Types with throwing destructors are not supported in Qt containers."); using Base::verify; @@ -655,7 +656,6 @@ template Q_INLINE_TEMPLATE QVarLengthArray::QVarLengthArray(qsizetype asize) { this->s = asize; - static_assert(Prealloc > 0, "QVarLengthArray Prealloc must be greater than 0."); Q_ASSERT_X(size() >= 0, "QVarLengthArray::QVarLengthArray()", "Size must be greater than or equal to 0."); if (size() > Prealloc) { this->ptr = malloc(size() * sizeof(T));