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 <ogoffart@woboq.com>
This commit is contained in:
Thiago Macieira 2013-09-06 10:25:30 -07:00 committed by The Qt Project
parent a23f5697a1
commit ff6754fb8c

View File

@ -46,8 +46,12 @@
#endif
#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
#endif
int main(int, char **) { return 0; }