From b9c1d1f7a15c7fdbb1f3ee69dc7529526e6079a5 Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Tue, 21 Jan 2025 12:26:09 +0100 Subject: [PATCH] Fix SFINAE constraint in flags debug streaming operator So that it allows overloading. Also move the type T declaration into the function scope, as it could never be used as a constraint anyway, and we do not want users to pass custom type there. Amends 0c707c6ebece18677deaccccdfec5d48c587106f. Found in 6.9 API review. Change-Id: I086d65bdef7be2f9e0e67e96cc8a9ac76eaa5b0f Reviewed-by: Marc Mutz Reviewed-by: Thiago Macieira (cherry picked from commit f1d2d47f609cfb3c4cf9b2a86072613b3c9e0642) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/io/qdebug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index b5053e827a1..582ee942952 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -628,10 +628,10 @@ void qt_QMetaEnum_flagDebugOperator(QDebug &debug, size_t sizeofT, Int value) } template ::value, void>, - typename T = typename Flags::enum_type> + std::enable_if_t::value, bool> = true> inline QDebug operator<<(QDebug debug, Flags flags) { + using T = typename Flags::enum_type; using UInt = typename QIntegerForSizeof::Unsigned; #if !defined(QT_NO_QOBJECT) if constexpr (QtPrivate::IsQEnumHelper::Value || QtPrivate::IsQEnumHelper::Value) {