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>
This commit is contained in:
Thiago Macieira 2015-07-13 18:09:23 -07:00
parent 29efec2d8c
commit 75d65600f9

View File

@ -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