libstdc++-v3/testsuite/20_util/uses_allocator/uninitialized_construct.cc
raw| 1 | // { dg-do compile { target c++20 } } |
| 2 | // TODO [!HOSTED]: avoidable std::allocator usage |
| 3 | // { dg-require-effective-target hosted } |
| 4 | |
| 5 | #include <memory> |
| 6 | |
| 7 | constexpr bool |
| 8 | test_pr104542() |
| 9 | { |
| 10 | // PR libstdc++/104542 - missing constexpr |
| 11 | std::allocator<int> a; |
| 12 | int* p = a.allocate(1); |
| 13 | int i = *std::uninitialized_construct_using_allocator<int>(p, a, 999); |
| 14 | a.deallocate(p, 1); |
| 15 | return i == 999; |
| 16 | } |
| 17 | |
| 18 | static_assert( test_pr104542() ); |