[libc++] Fix the build with GCC < 10

For now, we still need to support older GCCs, so work around the lack of
__is_constructible on older GCCs.
This commit is contained in:
Louis Dionne 2020-10-02 17:30:42 -04:00
parent aff896dea1
commit 04fce1515b
2 changed files with 8 additions and 2 deletions

View File

@ -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;
@ -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...)>

View File

@ -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"