[libcxx-commits] [libcxx] 04fce15 - [libc++] Fix the build with GCC < 10

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Oct 2 15:01:53 PDT 2020


Author: Louis Dionne
Date: 2020-10-02T18:01:48-04:00
New Revision: 04fce1515b7ae2fcf7986d8578c18cfd559c68b2

URL: https://github.com/llvm/llvm-project/commit/04fce1515b7ae2fcf7986d8578c18cfd559c68b2
DIFF: https://github.com/llvm/llvm-project/commit/04fce1515b7ae2fcf7986d8578c18cfd559c68b2.diff

LOG: [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.

Added: 
    

Modified: 
    libcxx/include/type_traits
    libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/include/type_traits b/libcxx/include/type_traits
index 03556389e2c6..75d60cddd305 100644
--- a/libcxx/include/type_traits
+++ b/libcxx/include/type_traits
@@ -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...)>

diff  --git a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
index e4fad7cd36c9..d8ee865d6de9 100644
--- a/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary/meta.unary.prop/is_constructible.pass.cpp
@@ -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"
 


        


More information about the libcxx-commits mailing list