[libcxx-commits] [libcxx] [libc++] Make list constexpr as part of P3372R3 (PR #129799)

Peng Liu via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 18 06:49:21 PDT 2025


================
@@ -239,12 +240,24 @@ void test_ctor_under_alloc_with_alloc() {
 #endif
 }
 
-int main(int, char**) {
+TEST_CONSTEXPR_CXX26 bool test() {
   basic_test();
   test_emplacable_concept();
   test_emplacable_concept_with_alloc();
-  test_ctor_under_alloc();
-  test_ctor_under_alloc_with_alloc();
+
+  if (!TEST_IS_CONSTANT_EVALUATED) {
+    test_ctor_under_alloc();
+    test_ctor_under_alloc_with_alloc();
----------------
winner245 wrote:

The main challenge I face here is that I found it not easy to avoid a singleton patten because we need to make sure that the same unique controller object (`AllocatorConstructionController`) must be used by multiple different types, including the test-allocator (`ContainerTestAllocator`), the test-types (`CopyInsertable'), and the tests (e.g., `ExpectConstructGuard`). In other words, a unique controller object must be shared. If we hold the controller as a member subobject inside any type, it is hard to ensure uniqueness of the controller object used by other types. 

https://github.com/llvm/llvm-project/pull/129799


More information about the libcxx-commits mailing list