From 72024ef741046331a057fea894b6ed8b48b702d2 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Fri, 1 Sep 2023 13:48:30 +0200 Subject: [PATCH] QAnyStringView: fix construction from QL1SV for bootstrapped builds The SizeShift was not taken into account when constructing QASV from QL1SV. This is not an issue in normal Qt builds, because SizeShift == 0 there. But in bootstrapped case (and in future Qt 7) SizeShift changes to 2, and the bug becomes visible. The tests that were available on dev were never picked to earlier branches, so the cherry-pick skips the test improvement. Change-Id: I337b37b5230323a5357f48fd1c9bf799ca507d52 Reviewed-by: Fabian Kosmale Reviewed-by: Thiago Macieira (cherry picked from commit d752da1857358726b89027ac039c20c1cd696b36) Reviewed-by: Marc Mutz --- src/corelib/text/qstring.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h index 7564314e042..1b3751755f8 100644 --- a/src/corelib/text/qstring.h +++ b/src/corelib/text/qstring.h @@ -89,7 +89,7 @@ qsizetype QStringView::count(QLatin1StringView s, Qt::CaseSensitivity cs) const // constexpr QAnyStringView::QAnyStringView(QLatin1StringView str) noexcept - : m_data{str.data()}, m_size{size_t(str.size()) | Tag::Latin1} {} + : m_data{str.data()}, m_size{size_t(str.size() << SizeShift) | Tag::Latin1} {} constexpr QLatin1StringView QAnyStringView::asLatin1StringView() const {