summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qcompilerdetection.h
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-07-13 18:09:23 -0700
committerThiago Macieira <thiago.macieira@intel.com>2016-05-08 18:10:36 +0000
commit75d65600f9fd41cb88068c664e3e94bb67eebc93 (patch)
tree9b8e056711400e6e5e0ffd45e75e28209e812469 /src/corelib/global/qcompilerdetection.h
parent29efec2d8cc8138f990fedc55a73e48635f999fb (diff)
Work around ICC's bug in making std::atomic a literal type
ICC 15.x and 16.0 (beta, at least) are missing the "constexpr" and "noexcept" keywords in the definition of the std::atomic constructors. The lack of constexpr makes std::atomic a non-literal type, which in turn makes QBasicAtomicInteger's constructor (which is constexpr) fail to compile. Reported as Intel issue 6000117277. Change-Id: I4a88bcca48bf0ce51557d809ef32a4545edcafee Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/global/qcompilerdetection.h')
-rw-r--r--src/corelib/global/qcompilerdetection.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index a08fde8bb0..85613283f9 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -1023,9 +1023,15 @@
// Also disable <atomic>, since it's clearly not there
# undef Q_COMPILER_ATOMICS
# endif
-# if defined(_LIBCPP_VERSION)
+# if defined(Q_CC_CLANG) && defined(Q_CC_INTEL) && Q_CC_INTEL >= 1500
+// ICC 15.x and 16.0 have their own implementation of std::atomic, which is activated when in Clang mode
+// (probably because libc++'s <atomic> on OS X failed to compile), but they're missing some
+// critical definitions. (Reported as Intel Issue ID 6000117277)
+# define __USE_CONSTEXPR 1
+# define __USE_NOEXCEPT 1
+# elif defined(_LIBCPP_VERSION)
// libc++ uses __has_feature(cxx_atomic), so disable the feature if the compiler
-// doesn't support it. That's required for the Intel compiler on OS X, for example.
+// doesn't support it. That's required for the Intel compiler 14.x or earlier on OS X, for example.
# if !__has_feature(cxx_atomic)
# undef Q_COMPILER_ATOMICS
# endif