diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index 44c5d8beacc..b4b9c96fb3c 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -796,8 +796,8 @@ Q_OUTOFLINE_TEMPLATE void QVLABase::assign_impl(qsizetype prealloc, void *arr ++first; } - qsizetype n = 0; - if constexpr (IsFwdIt && noexcept(T(*first))) { + qsizetype n; + if constexpr (IsFwdIt) { dst = std::uninitialized_copy(first, last, dst); n = dst - begin(); if (n > s) // otherwise: readjust 's' in erase() later diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index 3ad8a828570..2e727c5d4a9 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -109,7 +109,8 @@ Constructs an array with the contents in the iterator range [\a first, \a last). This constructor only participates in overload resolution if - \c InputIterator models the \c std::input_iterator concept. + \c InputIterator meets the requirements of an + \l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}. The value type of \c InputIterator must be convertible to \c T. */ @@ -1016,7 +1017,9 @@ number of elements in the range exceeds the capacity of the container. This function overload only participates in overload resolution if - \c InputIterator models the \c std::input_iterator concept. + \c InputIterator meets the requirements of an + \l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}. + The behavior is undefined if either argument is an iterator into *this. */