From 6e49553e77ddef5568d1a3e7ed365d35d1a9dda0 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Tue, 17 Nov 2020 01:18:09 -0800 Subject: [PATCH 1/2] First attempt at enabling the trait wholesale --- .../meta/meta.const.eval/is_constant_evaluated.pass.cpp | 7 +++++-- libcxx/include/type_traits | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.upstream-tests/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.pass.cpp b/.upstream-tests/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.pass.cpp index b0e0c645c8..762092cb41 100644 --- a/.upstream-tests/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.pass.cpp +++ b/.upstream-tests/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.pass.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03, c++11 +// UNSUPPORTED: c++98, c++03 // @@ -17,17 +17,20 @@ #include "test_macros.h" +// libcudacxx does not have feature test macros... yet +/* #ifndef __cpp_lib_is_constant_evaluated #if TEST_HAS_BUILTIN(__builtin_is_constant_evaluated) # error __cpp_lib_is_constant_evaluated should be defined #endif #endif +*/ template struct InTemplate {}; int main(int, char**) { -#ifdef __cpp_lib_is_constant_evaluated +#if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) // Test the signature { ASSERT_SAME_TYPE(decltype(cuda::std::is_constant_evaluated()), bool); diff --git a/libcxx/include/type_traits b/libcxx/include/type_traits index 41221c559f..ff2c3aea90 100644 --- a/libcxx/include/type_traits +++ b/libcxx/include/type_traits @@ -1562,7 +1562,7 @@ struct is_nothrow_convertible : _Or< template _LIBCUDACXX_INLINE_VAR constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To>::value; -#endif // _LIBCUDACXX_STD_VER > 11 +#endif // _LIBCUDACXX_STD_VER > 11 // is_empty @@ -4824,7 +4824,7 @@ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy> #endif #if defined(_LIBCUDACXX_IS_CONSTANT_EVALUATED) -#if _LIBCUDACXX_STD_VER > 17 +#if (defined(__cuda_std__) && _LIBCUDACXX_STD_VER >= 11) || _LIBCUDACXX_STD_VER > 17 _LIBCUDACXX_INLINE_VISIBILITY inline constexpr bool is_constant_evaluated() noexcept { return _LIBCUDACXX_IS_CONSTANT_EVALUATED(); From 0a119fb36cb9d3f217dfee9f31a3b26b074e2cb7 Mon Sep 17 00:00:00 2001 From: Wesley Maxey Date: Wed, 18 Nov 2020 00:43:20 -0800 Subject: [PATCH 2/2] Fixed version test in fail test --- .../meta/meta.const.eval/is_constant_evaluated.fail.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.upstream-tests/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.fail.cpp b/.upstream-tests/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.fail.cpp index 85fd2ffd1d..877342f40f 100644 --- a/.upstream-tests/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.fail.cpp +++ b/.upstream-tests/test/std/utilities/meta/meta.const.eval/is_constant_evaluated.fail.cpp @@ -19,7 +19,7 @@ int main(int, char**) { -#ifndef __cpp_lib_is_constant_evaluated +#ifndef _LIBCUDACXX_IS_CONSTANT_EVALUATED // expected-error@+1 {{no member named 'is_constant_evaluated' in namespace 'std'}} bool b = cuda::std::is_constant_evaluated(); #else