[libcxx-commits] [libcxx] [libc++][test] Refactor tests for ranges::swap_range algorithms (PR #121138)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Feb 19 09:19:06 PST 2025
================
@@ -51,72 +47,115 @@ auto can_swap_test(...) -> std::false_type;
template <class Tp>
constexpr bool can_swap() {
- return std::is_same<decltype(can_swap_test<Tp>(0)), void>::value;
+ return std::is_same<decltype(can_swap_test<Tp>(0)), void>::value;
}
#endif
-#if TEST_STD_VER > 17
-constexpr bool test_swap_constexpr()
-{
+#if TEST_STD_VER >= 11
+// This test is constexpr only since C++23 because constexpr std::unique_ptr is only available since C++23
+TEST_CONSTEXPR_CXX23 bool test_unique_ptr() {
----------------
ldionne wrote:
You can actually inline this into `test` below and use the `IS_CONSTANT_EVALUATED` trick to only run that part of the function when it can be run. That will simplify your `main()`.
https://github.com/llvm/llvm-project/pull/121138
More information about the libcxx-commits
mailing list