qt: Add patch to fix SFINAE warnings in QAnyStringView with gcc16
What changed, and why it matters
This commit adds a build-system patch for the Qt library used by Bitcoin Core. The patch moves two compile-time type checks (static_asserts) from inside a C++ class definition to outside it, because a newer GCC 16 compiler flag reports that the checks were placed where they could give misleading errors during template selection (SFINAE warnings). It is a build/toolchain compatibility fix, not a change to Bitcoin Core's consensus, networking, wallet, or node logic.
No security action required. Treat as a normal build maintenance commit. If reviewing, verify the patch checksum/source matches upstream Qt and that GCC 16 builds complete without new warnings.
Security signals we found
No security-relevant change to Bitcoin Core runtime code
Patch is a third-party Qt upstream build-compatibility fix
No mention of vulnerability, CVE, bug bounty, or security issue in commit or patch
Static assertions are moved, not removed, preserving the original invariant
Evidence from the diff
The change imports an upstream Qt patch (by Allan Sandfeld Jensen, reviewed by Marc Mutz) that relocates two static_assert statements from qanystringview.h to qanystringview.cpp. Inside the incomplete class, the traits QtPrivate::IsContainerCompatibleWithQStringView
Changed components
depends/packages/qt.mkdepends/patches/qt/fix-gcc16-sfinae-qanystringview.patchInspect captured patch +49 / −0
diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk
index 257735a3..c7c8fbdd 100644
--- a/depends/packages/qt.mk
+++ b/depends/packages/qt.mk
@@ -23,6 +23,7 @@ $(package)_patches += fix-gcc16-qcompare.patch
$(package)_patches += fix-gcc16-sfinae-qregularexpression.patch
$(package)_patches += fix-gcc16-sfinae-qchar.patch
$(package)_patches += fix-gcc16-sfinae-qbitarray.patch
+$(package)_patches += fix-gcc16-sfinae-qanystringview.patch
$(package)_patches += fix-qbytearray-include.patch
$(package)_qttranslations_file_name=$(qt_details_qttranslations_file_name)
@@ -278,6 +279,7 @@ define $(package)_preprocess_cmds
patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qregularexpression.patch && \
patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qchar.patch && \
patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qbitarray.patch && \
+ patch -p1 -i $($(package)_patch_dir)/fix-gcc16-sfinae-qanystringview.patch && \
patch -p1 -i $($(package)_patch_dir)/fix-qbytearray-include.patch
endef
ifeq ($(host),$(build))
diff --git a/depends/patches/qt/fix-gcc16-sfinae-qanystringview.patch b/depends/patches/qt/fix-gcc16-sfinae-qanystringview.patch
new file mode 100644
index 00000000..11c27949
--- /dev/null
+++ b/depends/patches/qt/fix-gcc16-sfinae-qanystringview.patch
@@ -0,0 +1,47 @@
+commit 27230157212c32420e71b28870d6c77630c3dc37
+Author: Allan Sandfeld Jensen <allan.jensen@qt.io>
+Date: Fri Aug 1 12:14:50 2025 +0200
+
+ Fix incomplete SFINAE of QAnyStringView
+
+ Inside the QAnyStringView class, the class is incomplete, and will
+ erroneously fail SFINAE. Do the assert after for it to actually work.
+
+ Detected with gcc 16.
+
+ Amends 2c9529e158fc589c48e6b1fb61dca2133e33ac4d.
+
+ Pick-to: 6.10 6.9 6.8 6.5
+ Change-Id: Ifd3ad6d3ec17cd1725fb8b735469502791f9e9a3
+ Reviewed-by: Marc Mutz <marc.mutz@qt.io>
+
+diff --git a/qtbase/src/corelib/text/qanystringview.cpp b/qtbase/src/corelib/text/qanystringview.cpp
+index 7bf8a3fa1fd..3c993ff1da0 100644
+--- a/qtbase/src/corelib/text/qanystringview.cpp
++++ b/qtbase/src/corelib/text/qanystringview.cpp
+@@ -243,6 +243,10 @@ QT_BEGIN_NAMESPACE
+ \sa isNull(), isEmpty()
+ */
+
++// confirm we don't make an accidental copy constructor:
++static_assert(QtPrivate::IsContainerCompatibleWithQStringView<QAnyStringView>::value == false);
++static_assert(QtPrivate::IsContainerCompatibleWithQUtf8StringView<QAnyStringView>::value == false);
++
+ /*!
+ \fn template <typename Char, size_t Size> static QAnyStringView fromArray(const Char (&string)[Size]) noexcept
+
+diff --git a/qtbase/src/corelib/text/qanystringview.h b/qtbase/src/corelib/text/qanystringview.h
+index 9617209059b..69b7fafb438 100644
+--- a/qtbase/src/corelib/text/qanystringview.h
++++ b/qtbase/src/corelib/text/qanystringview.h
+@@ -96,10 +96,6 @@ private:
+ std::is_convertible<T, QStringOrQByteArray>
+ >, bool>;
+
+- // confirm we don't make an accidental copy constructor:
+- static_assert(QtPrivate::IsContainerCompatibleWithQStringView<QAnyStringView>::value == false);
+- static_assert(QtPrivate::IsContainerCompatibleWithQUtf8StringView<QAnyStringView>::value == false);
+-
+ template<typename Char>
+ static constexpr bool isAsciiOnlyCharsAtCompileTime(Char *str, qsizetype sz) noexcept
+ {
Why this scored 14/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.