path: root/config.tests
diff options
authorThiago Macieira <>2013-09-06 10:25:30 -0700
committerThe Qt Project <>2013-09-09 23:04:48 +0200
commitff6754fb8cb662de3066c1dcca6cf6d56db41671 (patch)
tree362d9d1c29c6f24f9ce826a9b45a6b762955e278 /config.tests
parenta23f5697a1f1fea970d665ca6c0671feecd21d6a (diff)
Allow Clang to compile without libc++
Clang is perfectly able to deal with the libstdc++ headers. The problem on Mac is that those headers are mightily old (from GCC 4.2), so they are insufficient for C++11 support. So make a more accurate test. This allows Clang to enable C++11 in the presence of newer libstdc++ header (e.g., Clang on Linux or Clang on FreeBSD). Change-Id: I4f457ca82bf13feca0af78c9363cb6365bb3f68e Reviewed-by: Olivier Goffart <>
Diffstat (limited to 'config.tests')
1 files changed, 6 insertions, 2 deletions
diff --git a/config.tests/common/c++11/c++11.cpp b/config.tests/common/c++11/c++11.cpp
index a14a26f81e..2c501ad6ca 100644
--- a/config.tests/common/c++11/c++11.cpp
+++ b/config.tests/common/c++11/c++11.cpp
@@ -46,8 +46,12 @@
#include <utility>
-#if defined(__clang__) && !defined(_LIBCPP_VERSION)
-# error "C++11 with clang requires libc++ runtime"
+#if defined(__clang__)
+# if __has_feature(cxx_generalized_initializers)
+// On Mac OS X, the libstdc++ headers don't include <initializer_list>
+// This #include here forces a failure unless we're using libc++
+# include <initializer_list>
+# endif
int main(int, char **) { return 0; }