Skip to content
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.

Enable is_constant_evaluated in c++11 #76

Merged
merged 2 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03, c++11
// UNSUPPORTED: c++98, c++03

// <cuda/std/type_traits>

Expand All @@ -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 <bool> 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);
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ struct is_nothrow_convertible : _Or<
template <typename _Fm, typename _To>
_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

Expand Down Expand Up @@ -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();
Expand Down