From ff6754fb8cb662de3066c1dcca6cf6d56db41671 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 6 Sep 2013 10:25:30 -0700 Subject: [PATCH] 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 --- config.tests/common/c++11/c++11.cpp | 8 ++++++-- 1 file 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 @@ #endif #include -#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 +// This #include here forces a failure unless we're using libc++ +# include +# endif #endif int main(int, char **) { return 0; }