Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for clang.
authorErik Verbruggen <erik.verbruggen@digia.com>
Tue, 6 Nov 2012 10:22:16 +0000 (11:22 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 7 Nov 2012 09:27:04 +0000 (10:27 +0100)
This triggers a bug in clang (before version 3.2). See also the bug
report: http://llvm.org/bugs/show_bug.cgi?id=12670 .

Change-Id: I9e0bc1cc39059ffa5e062652b932bc01e453ef98
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
src/corelib/thread/qbasicatomic.h

index 6072212..4177ddb 100644 (file)
@@ -117,7 +117,18 @@ QT_END_HEADER
 // New atomics
 
 #if defined(Q_COMPILER_CONSTEXPR) && defined(Q_COMPILER_DEFAULT_MEMBERS) && defined(Q_COMPILER_DELETE_MEMBERS)
-# define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
+# if defined(Q_CC_CLANG) && ((((__clang_major__ * 100) + __clang_minor__) < 302) \
+                             || defined(__apple_build_version__) \
+                            )
+   /* Do not define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS for "stock" clang before version 3.2.
+      Apple's version has different (higher!) version numbers, so disable it for all of them for now.
+      (The only way to distinguish between them seems to be a check for __apple_build_version__ .)
+
+      For details about the bug: see http://llvm.org/bugs/show_bug.cgi?id=12670
+    */
+# else
+#  define QT_BASIC_ATOMIC_HAS_CONSTRUCTORS
+# endif
 #endif
 
 template <typename T>