fix-gcc16-sfinae-qanystringview.patch raw
1 commit 27230157212c32420e71b28870d6c77630c3dc37
2 Author: Allan Sandfeld Jensen <allan.jensen@qt.io>
3 Date: Fri Aug 1 12:14:50 2025 +0200
4
5 Fix incomplete SFINAE of QAnyStringView
6
7 Inside the QAnyStringView class, the class is incomplete, and will
8 erroneously fail SFINAE. Do the assert after for it to actually work.
9
10 Detected with gcc 16.
11
12 Amends 2c9529e158fc589c48e6b1fb61dca2133e33ac4d.
13
14 Pick-to: 6.10 6.9 6.8 6.5
15 Change-Id: Ifd3ad6d3ec17cd1725fb8b735469502791f9e9a3
16 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
17
18 diff --git a/qtbase/src/corelib/text/qanystringview.cpp b/qtbase/src/corelib/text/qanystringview.cpp
19 index 7bf8a3fa1fd..3c993ff1da0 100644
20 --- a/qtbase/src/corelib/text/qanystringview.cpp
21 +++ b/qtbase/src/corelib/text/qanystringview.cpp
22 @@ -243,6 +243,10 @@ QT_BEGIN_NAMESPACE
23 \sa isNull(), isEmpty()
24 */
25
26 +// confirm we don't make an accidental copy constructor:
27 +static_assert(QtPrivate::IsContainerCompatibleWithQStringView<QAnyStringView>::value == false);
28 +static_assert(QtPrivate::IsContainerCompatibleWithQUtf8StringView<QAnyStringView>::value == false);
29 +
30 /*!
31 \fn template <typename Char, size_t Size> static QAnyStringView fromArray(const Char (&string)[Size]) noexcept
32
33 diff --git a/qtbase/src/corelib/text/qanystringview.h b/qtbase/src/corelib/text/qanystringview.h
34 index 9617209059b..69b7fafb438 100644
35 --- a/qtbase/src/corelib/text/qanystringview.h
36 +++ b/qtbase/src/corelib/text/qanystringview.h
37 @@ -96,10 +96,6 @@ private:
38 std::is_convertible<T, QStringOrQByteArray>
39 >, bool>;
40
41 - // confirm we don't make an accidental copy constructor:
42 - static_assert(QtPrivate::IsContainerCompatibleWithQStringView<QAnyStringView>::value == false);
43 - static_assert(QtPrivate::IsContainerCompatibleWithQUtf8StringView<QAnyStringView>::value == false);
44 -
45 template<typename Char>
46 static constexpr bool isAsciiOnlyCharsAtCompileTime(Char *str, qsizetype sz) noexcept
47 {
48