Skip to content

Commit

Permalink
[libc++] [test] C++14/17-friendly TEST_IS_CONSTANT_EVALUATED macro.
Browse files Browse the repository at this point in the history
Reviewed as part of D114658.
Ultimately this will probably have to be flipped around and renamed
`TEST_IS_RUNTIME`, and extended with `TEST_IS_RUNTIME_OR_CXX20` (once
constexpr std::string support is added) and so on for every new C++
version. But we don't need that flexibility yet, so we're not adding it.
  • Loading branch information
Arthur O'Dwyer committed Dec 1, 2021
1 parent a0b50c5 commit b4a13e4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libcxx/test/support/test_macros.h
Expand Up @@ -146,9 +146,11 @@
#endif

#if defined(__cpp_lib_is_constant_evaluated) && __cpp_lib_is_constant_evaluated >= 201811L
# define TEST_IS_CONSTANT_EVALUATED std::is_constant_evaluated()
# define TEST_IS_CONSTANT_EVALUATED std::is_constant_evaluated()
#elif __has_builtin(__builtin_is_constant_evaluated)
# define TEST_IS_CONSTANT_EVALUATED __builtin_is_constant_evaluated()
#else
# define TEST_IS_CONSTANT_EVALUATED false
# define TEST_IS_CONSTANT_EVALUATED false
#endif

#if TEST_STD_VER >= 14
Expand Down

0 comments on commit b4a13e4

Please sign in to comment.