libstdc++-v3/testsuite/20_util/allocator/105975.cc
raw| 1 | // { dg-do compile { target c++20 } } |
| 2 | // { dg-require-effective-target hosted } |
| 3 | |
| 4 | // PR libstdc++/105957 |
| 5 | |
| 6 | #include <memory> |
| 7 | |
| 8 | consteval bool test_pr105957() |
| 9 | { |
| 10 | std::allocator<long long> a; |
| 11 | auto n = std::size_t(-1) / (sizeof(long long) - 1); |
| 12 | auto p = a.allocate(n); // { dg-error "constexpr" } |
| 13 | a.deallocate(p, n); |
| 14 | return true; |
| 15 | } |
| 16 | static_assert( test_pr105957() ); // { dg-error "non-constant" } |
| 17 | |
| 18 | // { dg-error "throw_bad_array_new_length" "" { target *-*-* } 0 } |