[libcxx-commits] [libcxx] 0fa67d4 - [libc++] Enables constexpr string tests.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jul 1 03:27:46 PDT 2023


Author: Mark de Wever
Date: 2023-07-01T12:26:48+02:00
New Revision: 0fa67d44e0abc1c79ed9b3fffcbab4681fbe4d6a

URL: https://github.com/llvm/llvm-project/commit/0fa67d44e0abc1c79ed9b3fffcbab4681fbe4d6a
DIFF: https://github.com/llvm/llvm-project/commit/0fa67d44e0abc1c79ed9b3fffcbab4681fbe4d6a.diff

LOG: [libc++] Enables constexpr string tests.

These tests were disabled during constant evaluation in D90569. At that
time constexpr string was not implemented. It now is.

Reviewed By: #libc, philnik

Differential Revision: https://reviews.llvm.org/D154227

Added: 
    

Modified: 
    libcxx/test/std/numerics/numeric.ops/accumulate/accumulate_op.pass.cpp
    libcxx/test/std/numerics/numeric.ops/adjacent.difference/adjacent_difference_op.pass.cpp
    libcxx/test/std/numerics/numeric.ops/inner.product/inner_product_comp.pass.cpp
    libcxx/test/std/numerics/numeric.ops/partial.sum/partial_sum_op.pass.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/numerics/numeric.ops/accumulate/accumulate_op.pass.cpp b/libcxx/test/std/numerics/numeric.ops/accumulate/accumulate_op.pass.cpp
index 884ac942b196cb..db1ca0527a7918 100644
--- a/libcxx/test/std/numerics/numeric.ops/accumulate/accumulate_op.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/accumulate/accumulate_op.pass.cpp
@@ -59,17 +59,7 @@ test_use_move()
 }
 #endif // TEST_STD_VER > 17
 
-// C++20 can use string in constexpr evaluation, but both libc++ and MSVC
-// don't have the support yet. In these cases omit the constexpr test.
-// FIXME Remove constexpr string workaround introduced in D90569
-#if TEST_STD_VER > 17 && \
-    (!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
-void
-#else
-TEST_CONSTEXPR_CXX20 void
-#endif
-test_string()
-{
+TEST_CONSTEXPR_CXX20 void test_string() {
     std::string sa[] = {"a", "b", "c"};
     assert(std::accumulate(sa, sa + 3, std::string()) == "abc");
     assert(std::accumulate(sa, sa + 3, std::string(), std::plus<std::string>()) == "abc");
@@ -110,13 +100,7 @@ test()
 #if TEST_STD_VER > 17
     test_use_move();
 #endif // TEST_STD_VER > 17
-    // C++20 can use string in constexpr evaluation, but both libc++ and MSVC
-    // don't have the support yet. In these cases omit the constexpr test.
-    // FIXME Remove constexpr string workaround introduced in D90569
-#if TEST_STD_VER > 17 && \
-    (!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
-    if (!std::is_constant_evaluated())
-#endif
+
     test_string();
 
     return true;

diff  --git a/libcxx/test/std/numerics/numeric.ops/adjacent.
diff erence/adjacent_
diff erence_op.pass.cpp b/libcxx/test/std/numerics/numeric.ops/adjacent.
diff erence/adjacent_
diff erence_op.pass.cpp
index 86c55d3c0bf67a..4cd44580203f45 100644
--- a/libcxx/test/std/numerics/numeric.ops/adjacent.
diff erence/adjacent_
diff erence_op.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/adjacent.
diff erence/adjacent_
diff erence_op.pass.cpp
@@ -66,17 +66,7 @@ test_use_move()
 }
 #endif // TEST_STD_VER > 17
 
-// C++20 can use string in constexpr evaluation, but both libc++ and MSVC
-// don't have the support yet. In these cases omit the constexpr test.
-// FIXME Remove constexpr string workaround introduced in D90569
-#if TEST_STD_VER > 17 && \
-    (!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
-void
-#else
-TEST_CONSTEXPR_CXX20 void
-#endif
-test_string()
-{
+TEST_CONSTEXPR_CXX20 void test_string() {
     std::string sa[] = {"a", "b", "c"};
     std::string sr[] = {"a", "ba", "cb"};
     std::string output[3];
@@ -179,13 +169,7 @@ test()
 #if TEST_STD_VER > 17
     test_use_move();
 #endif // TEST_STD_VER > 17
-    // C++20 can use string in constexpr evaluation, but both libc++ and MSVC
-    // don't have the support yet. In these cases omit the constexpr test.
-    // FIXME Remove constexpr string workaround introduced in D90569
-#if TEST_STD_VER > 17 && \
-    (!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
-    if (!std::is_constant_evaluated())
-#endif
+
     test_string();
 
     return true;

diff  --git a/libcxx/test/std/numerics/numeric.ops/inner.product/inner_product_comp.pass.cpp b/libcxx/test/std/numerics/numeric.ops/inner.product/inner_product_comp.pass.cpp
index 250e9e8663d2a8..d155643c2c1a7a 100644
--- a/libcxx/test/std/numerics/numeric.ops/inner.product/inner_product_comp.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/inner.product/inner_product_comp.pass.cpp
@@ -73,17 +73,7 @@ test_use_move()
 }
 #endif // TEST_STD_VER > 17
 
-// C++20 can use string in constexpr evaluation, but both libc++ and MSVC
-// don't have the support yet. In these cases omit the constexpr test.
-// FIXME Remove constexpr string workaround introduced in D90569
-#if TEST_STD_VER > 17 && \
-    (!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
-void
-#else
-TEST_CONSTEXPR_CXX20 void
-#endif
-test_string()
-{
+TEST_CONSTEXPR_CXX20 void test_string() {
     std::string sa[] = {"a", "b", "c"};
     assert(std::accumulate(sa, sa + 3, std::string()) == "abc");
     assert(std::accumulate(sa, sa + 3, std::string(), std::plus<std::string>()) == "abc");
@@ -150,13 +140,7 @@ test()
 #if TEST_STD_VER > 17
     test_use_move();
 #endif // TEST_STD_VER > 17
-    // C++20 can use string in constexpr evaluation, but both libc++ and MSVC
-    // don't have the support yet. In these cases omit the constexpr test.
-    // FIXME Remove constexpr string workaround introduced in D90569
-#if TEST_STD_VER > 17 && \
-    (!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
-    if (!std::is_constant_evaluated())
-#endif
+
     test_string();
 
     return true;

diff  --git a/libcxx/test/std/numerics/numeric.ops/partial.sum/partial_sum_op.pass.cpp b/libcxx/test/std/numerics/numeric.ops/partial.sum/partial_sum_op.pass.cpp
index 42ec305bf2b850..7fc9dbf100909f 100644
--- a/libcxx/test/std/numerics/numeric.ops/partial.sum/partial_sum_op.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/partial.sum/partial_sum_op.pass.cpp
@@ -65,17 +65,7 @@ test_use_move()
 }
 #endif // TEST_STD_VER > 17
 
-// C++20 can use string in constexpr evaluation, but both libc++ and MSVC
-// don't have the support yet. In these cases omit the constexpr test.
-// FIXME Remove constexpr string workaround introduced in D90569
-#if TEST_STD_VER > 17 && \
-    (!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
-void
-#else
-TEST_CONSTEXPR_CXX20 void
-#endif
-test_string()
-{
+TEST_CONSTEXPR_CXX20 void test_string() {
     std::string sa[] = {"a", "b", "c"};
     std::string sr[] = {"a", "ba", "cb"};
     std::string output[3];
@@ -133,13 +123,7 @@ test()
 #if TEST_STD_VER > 17
     test_use_move();
 #endif // TEST_STD_VER > 17
-    // C++20 can use string in constexpr evaluation, but both libc++ and MSVC
-    // don't have the support yet. In these cases omit the constexpr test.
-    // FIXME Remove constexpr string workaround introduced in D90569
-#if TEST_STD_VER > 17 && \
-    (!defined(__cpp_lib_constexpr_string) || __cpp_lib_constexpr_string < 201907L)
-    if (!std::is_constant_evaluated())
-#endif
+
     test_string();
 
     return true;


        


More information about the libcxx-commits mailing list