From f01f1943e49ac3a60c54dd3f3009a445474dc412 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sun, 26 Jul 2015 14:14:31 +0200 Subject: Fix compilation error while instantiating operator<< explicitly Task-number: QTBUG-47375 Change-Id: Ibd260de88c174c1aa3833a56b153b8b74d337338 Reviewed-by: Thiago Macieira --- src/corelib/io/qdebug.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/corelib/io/qdebug.h') diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 59bd32e9a4..3c3ceba249 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -278,7 +278,7 @@ template inline typename QtPrivate::QEnableIf< QtPrivate::IsQEnumHelper::Value || QtPrivate::IsQEnumHelper >::Value, QDebug>::Type -operator<<(QDebug debug, const QFlags &flags) +qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags &flags) { const QMetaObject *obj = qt_getEnumMetaObject(T()); const char *name = qt_getEnumName(T()); @@ -289,10 +289,10 @@ template inline typename QtPrivate::QEnableIf< !QtPrivate::IsQEnumHelper::Value && !QtPrivate::IsQEnumHelper >::Value, QDebug>::Type -operator<<(QDebug debug, const QFlags &flags) +qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags &flags) #else // !QT_NO_QOBJECT template -inline QDebug operator<<(QDebug debug, const QFlags &flags) +inline QDebug qt_QMetaEnum_flagDebugOperator_helper(QDebug debug, const QFlags &flags) #endif { QDebugStateSaver saver(debug); @@ -312,6 +312,14 @@ inline QDebug operator<<(QDebug debug, const QFlags &flags) return debug; } +template +inline QDebug operator<<(QDebug debug, const QFlags &flags) +{ + // We have to use an indirection otherwise specialisation of some other overload of the + // operator<< the compiler would try to instantiate QFlags for the QEnableIf + return qt_QMetaEnum_flagDebugOperator_helper(debug, flags); +} + #ifdef Q_OS_MAC // We provide QDebug stream operators for commonly used Core Foundation -- cgit v1.2.3