[libcxx-commits] [libcxx] [libc++] Make list constexpr as part of P3372R3 (PR #129799)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 12 12:21:24 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:
I still find it challenging to make these two tests `constexpr`, because the `AllocatorConstructController` type must use a singleton pattern (as the test-types, test-allocator and test need to share the same controller), meaning that the controller object must be a `static` variable. Whether it is a local static (https://godbolt.org/z/8eYxoj9or) or class static (https://godbolt.org/z/xnzh693WK) variable, I found it not possible to achieve a constexpr implementation.
https://github.com/llvm/llvm-project/pull/129799
More information about the libcxx-commits
mailing list