From 25d1db424e3bd00d5c008168ee4cb735d88ed9ac Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 4 Dec 2023 09:42:25 +0100 Subject: [PATCH] QUtf8StringView: make data() constexpr The cast that prevented it was a remnant of QStringView (which, like QString itself, stores char16_t, but interfaces in QChar). Remove the cast, add the constexpr. [ChangeLog][QtCore][QUtf8StringView] data() is now constexpr, too. Change-Id: I7891b89bf26176484411b4388ded04e56651b607 Reviewed-by: Ivan Solovev --- src/corelib/text/qutf8stringview.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/text/qutf8stringview.h b/src/corelib/text/qutf8stringview.h index 1230e17484..d653b99cfb 100644 --- a/src/corelib/text/qutf8stringview.h +++ b/src/corelib/text/qutf8stringview.h @@ -202,7 +202,7 @@ public: [[nodiscard]] inline QString toString() const; // defined in qstring.h [[nodiscard]] constexpr qsizetype size() const noexcept { return m_size; } - [[nodiscard]] const_pointer data() const noexcept { return reinterpret_cast(m_data); } + [[nodiscard]] constexpr const_pointer data() const noexcept { return m_data; } #ifdef __cpp_char8_t [[nodiscard]] const char8_t *utf8() const noexcept { return reinterpret_cast(m_data); } #endif