]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Make __gnu_test::default_init_allocator usable in constexpr
authorJonathan Wakely <jwakely@redhat.com>
Thu, 1 May 2025 21:41:40 +0000 (22:41 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Fri, 2 May 2025 10:53:22 +0000 (11:53 +0100)
commit869accb241c84f132ac0c9cd4e5ad9b4b7e6d536
tree3a2b2d4c6125d25d5d1d5ecab997b365371e9c1a
parenta9ef2ae2e5a7e6d8febdac3806587a1ea555533c
libstdc++: Make __gnu_test::default_init_allocator usable in constexpr

If we make this test allocator usable in constant expressions then we'll
get an error if the 'state' data member isn't initialized. This makes it
a more reliable check that allocators are correctly value-initialized
when they're required to be.

libstdc++-v3/ChangeLog:

* testsuite/23_containers/vector/allocator/default_init.cc:
Add a check using constant evaluation.
* testsuite/23_containers/vector/bool/allocator/default_init.cc:
Likewise.
* testsuite/util/testsuite_allocator.h (default_init_allocator):
Make all member functions and equality ops constexpr.
libstdc++-v3/testsuite/23_containers/vector/allocator/default_init.cc
libstdc++-v3/testsuite/23_containers/vector/bool/allocator/default_init.cc
libstdc++-v3/testsuite/util/testsuite_allocator.h