diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-02-10 15:46:44 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-02-10 15:47:03 +0100 |
commit | f58769c8f177601fe73cdec2042a0a65801261b3 (patch) | |
tree | 0fa24e5e9aff6704c3549063d5ab86129ae86062 /configure.ac | |
parent | 5b8947a093216a546881a749dec8d637ff1b7dd1 (diff) |
Properly check for Clang with static initializer_list bug
Change-Id: I98060f1adae0ba8ec03b2f0d6b0db6d5a1c0385c
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 0e27a30a04e8..8ad4f6ca6fef 100644 --- a/configure.ac +++ b/configure.ac @@ -6225,6 +6225,34 @@ if test "$GCC" = "yes"; then fi AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR) +AC_MSG_CHECKING([whether $CXX has broken static initializer_list support]) +save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11" +AC_LANG_PUSH([C++]) +AC_RUN_IFELSE([AC_LANG_PROGRAM([[ + // Exit with failure if the static initializer_list is stored on the stack + // (as done by Clang < 3.4): + #include <initializer_list> + struct S {}; + bool g(void const * p1, void const * p2) { + int n; + return !((p1 > p2 && p2 > &n) || (p1 < p2 && p2 < &n)); + } + bool f(void const * p1) { + static std::initializer_list<S> s { S() }; + return g(p1, s.begin()); + } + ]],[[ + int n; + return f(&n) ? 0 : 1; + ]])], [broken=no], [broken=yes]) +AC_LANG_POP([C++]) +CXXFLAGS=$save_CXXFLAGS +AC_MSG_RESULT([$broken]) +if test "$broken" = yes; then + AC_DEFINE([HAVE_BROKEN_STATIC_INITILIZER_LIST]) +fi + dnl =================================================================== dnl system stl sanity tests dnl =================================================================== |