diff --git a/cmake/QtHeadersClean.cmake b/cmake/QtHeadersClean.cmake index 955f325e3f..5f1cc9fd0c 100644 --- a/cmake/QtHeadersClean.cmake +++ b/cmake/QtHeadersClean.cmake @@ -186,7 +186,7 @@ function(qt_internal_add_headersclean_target module_target module_headers) # Note we can't enable -Za, as it does not support certain key Microsoft SDK header files # we use. Microsoft suggests to use /permissive- instead, which is implicity set by # -std:c++latest. - set(hcleanFLAGS -std:c++latest -Zc:__cplusplus -WX -W3 -EHsc) + set(hcleanFLAGS -std:c++latest -Zc:__cplusplus -WX -W4 -EHsc) # Because we now add `-DNOMINMAX` to `PlatformCommonInternal`. set(hcleanUDEFS -UNOMINMAX) diff --git a/src/corelib/kernel/qiterable.h b/src/corelib/kernel/qiterable.h index 1178c5e8a3..4adcdfd76f 100644 --- a/src/corelib/kernel/qiterable.h +++ b/src/corelib/kernel/qiterable.h @@ -71,28 +71,32 @@ public: QTaggedIterator(Iterator &&it) : Iterator(std::move(it)) { const QMetaContainer metaContainer = this->metaContainer(); - if (std::is_base_of_v - && !metaContainer.hasRandomAccessIterator()) { - qFatal("You cannot use this iterator as a random access iterator"); - this->clearIterator(); + if constexpr (std::is_base_of_v) { + if (!metaContainer.hasRandomAccessIterator()) { + qFatal("You cannot use this iterator as a random access iterator"); + this->clearIterator(); + } } - if (std::is_base_of_v - && !metaContainer.hasBidirectionalIterator()) { - qFatal("You cannot use this iterator as a bidirectional iterator"); - this->clearIterator(); + if constexpr (std::is_base_of_v) { + if (!metaContainer.hasBidirectionalIterator()) { + qFatal("You cannot use this iterator as a bidirectional iterator"); + this->clearIterator(); + } } - if (std::is_base_of_v - && !metaContainer.hasForwardIterator()) { - qFatal("You cannot use this iterator as a forward iterator"); - this->clearIterator(); + if constexpr (std::is_base_of_v) { + if (!metaContainer.hasForwardIterator()) { + qFatal("You cannot use this iterator as a forward iterator"); + this->clearIterator(); + } } - if (std::is_base_of_v - && !metaContainer.hasInputIterator()) { - qFatal("You cannot use this iterator as an input iterator"); - this->clearIterator(); + if constexpr (std::is_base_of_v) { + if (!metaContainer.hasInputIterator()) { + qFatal("You cannot use this iterator as an input iterator"); + this->clearIterator(); + } } } diff --git a/src/corelib/text/qstringbuilder.h b/src/corelib/text/qstringbuilder.h index fb44a56633..53f8865edf 100644 --- a/src/corelib/text/qstringbuilder.h +++ b/src/corelib/text/qstringbuilder.h @@ -106,10 +106,15 @@ private: // 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); - if (!QConcatenable< QStringBuilder >::ExactSize && len != d - start) { + if constexpr (QConcatenable>::ExactSize) { + QConcatenable>::appendTo(*this, d); + return s; + } + + typename T::const_iterator const start = d; + QConcatenable>::appendTo(*this, d); + if (len != d - start) { // this resize is necessary since we allocate a bit too much // when dealing with variable sized 8-bit encodings s.resize(d - start);