summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/20_util/allocator/105975.cc
blob: 4342aeade046e122dccff3610183df4f27eb0030 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// { dg-options "-std=gnu++20" }
// { dg-do compile { target c++20 } }

// PR libstdc++/105957

#include <memory>

consteval bool test_pr105957()
{
  std::allocator<long long> a;
  auto n = std::size_t(-1) / (sizeof(long long) - 1);
  auto p = a.allocate(n); // { dg-error "constexpr" }
  a.deallocate(p, n);
  return true;
}
static_assert( test_pr105957() );

// { dg-error "throw_bad_array_new_length" "" { target *-*-* } 0 }