diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h index e09b02b5a9..489357f5fd 100644 --- a/src/corelib/tools/qstringbuilder.h +++ b/src/corelib/tools/qstringbuilder.h @@ -112,7 +112,9 @@ private: const uint len = QConcatenable< QStringBuilder >::size(*this); T s(len, Qt::Uninitialized); - typename T::iterator d = s.data(); + // we abuse const_cast / constData here because we know we've just + // allocated the data and we're the only reference count + typename T::iterator d = const_cast(s.constData()); typename T::const_iterator const start = d; QConcatenable< QStringBuilder >::appendTo(*this, d);