diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 8e52c50322947fbb4249cbb718fcd08f5fd65df4..d7d56995914771f99450c1c3db71707cc71eeb3e 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -881,6 +881,13 @@
 #  undef Q_COMPILER_RVALUE_REFS
 #  undef Q_COMPILER_REF_QUALIFIERS
 # endif
+# if 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.
+#  if !__has_feature(cxx_atomic)
+#   undef Q_COMPILER_ATOMICS
+#  endif
+# endif
 # if defined(Q_COMPILER_THREADSAFE_STATICS) && defined(Q_OS_MAC)
 // Mac OS X: Apple's low-level implementation of the C++ support library
 // (libc++abi.dylib, shared between libstdc++ and libc++) has deadlocks. The