Skip to content

Commit

Permalink
[libc++] Fix the build with GCC < 10
Browse files Browse the repository at this point in the history
For now, we still need to support older GCCs, so work around the lack of
__is_constructible on older GCCs.
  • Loading branch information
ldionne committed Oct 2, 2020
1 parent aff896d commit 04fce15
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions libcxx/include/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -2883,7 +2883,11 @@ namespace __is_construct
struct __nat {};
}

#if !defined(_LIBCPP_CXX03_LANG) && !__has_feature(is_constructible) && !defined(_LIBCPP_COMPILER_GCC)
#if defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER_NEW >= 10000
# define _LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE
#endif

#if !defined(_LIBCPP_CXX03_LANG) && !__has_feature(is_constructible) && !defined(_LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE)

template <class _Tp, class... _Args>
struct __libcpp_is_constructible;
Expand Down Expand Up @@ -2998,7 +3002,7 @@ struct __libcpp_is_constructible<_Tp&&, _A0>

#endif

#if __has_feature(is_constructible) || defined(_LIBCPP_COMPILER_GCC)
#if __has_feature(is_constructible) || defined(_LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE)
template <class _Tp, class ..._Args>
struct _LIBCPP_TEMPLATE_VIS is_constructible
: public integral_constant<bool, __is_constructible(_Tp, _Args...)>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
// template <class T, class... Args>
// struct is_constructible;

// UNSUPPORTED: gcc-5, gcc-6, gcc-7, gcc-8, gcc-9

#include <type_traits>
#include "test_macros.h"

Expand Down

0 comments on commit 04fce15

Please sign in to comment.