summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2014-08-14 09:07:24 -0700
committerThiago Macieira <thiago.macieira@intel.com>2014-08-19 17:33:25 +0200
commit36a30d8e49def2999917bb12489dcbfbbfa99209 (patch)
treee83eb57478b64cd2e1534b95b803307c3b70d2f9 /src/corelib/global
parent41f496cb7f63da012f73bfe7904c225e91d300da (diff)
Restore foreach macro for GCC 4.3 and 4.4 in C++11 mode
In C++98, typename can only be used for argument-dependent types and that's not the case here. This was tracked as language defect 382 and was fixed in the final C++11 standard, but the fix didn't make it to GCC 4.3 and 4.4 (which do have decltype). qthreadpool.cpp:274: error: using 'typename' outside of template Task-number: QTBUG-40783 Change-Id: I0eb702b33d2e8c95284f52841b0021dbfc743874 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 5210d80953..dda870a4a1 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -880,7 +880,12 @@ public:
int control;
};
-# ifdef Q_COMPILER_DECLTYPE
+// We need to use __typeof__ if we don't have decltype or if the compiler
+// hasn't been updated to the fix of Core Language Defect Report 382
+// (http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#382).
+// GCC 4.3 and 4.4 have support for decltype, but are affected by DR 382.
+# if defined(Q_COMPILER_DECLTYPE) && \
+ (defined(Q_CC_CLANG) || defined(Q_CC_INTEL) || !defined(Q_CC_GNU) || (__GNUC__ * 100 + __GNUC_MINOR__) >= 405)
# define QT_FOREACH_DECLTYPE(x) typename QtPrivate::remove_reference<decltype(x)>::type
# else
# define QT_FOREACH_DECLTYPE(x) __typeof__((x))