2 // Avoid use of non-overridable new/delete operators in shared
3 // { dg-options "-static" { target *-*-mingw* } }
4 // Test __cxa_vec routines
5 // Copyright (C) 2000-2015 Free Software Foundation, Inc.
6 // Contributed by Nathan Sidwell 7 Apr 2000 <nathan@nathan@codesourcery.com>
14 // Allocate enough padding to hold an array cookie.
16 static const size_t padding
= 8;
18 static const size_t padding
= (sizeof (std::size_t));
21 // our pseudo ctors and dtors
22 static abi::__cxa_cdtor_return_type
ctor (void *x
)
27 static abi::__cxa_cdtor_return_type
dtor (void *x
)
32 // allocate an array whose size causes an overflow during multiplication
35 static const std::size_t large_size
=
36 std::size_t(1) << (sizeof(std::size_t) * 8 - 2);
39 abi::__cxa_vec_new (large_size
, 8, 0, ctor
, dtor
);
42 catch (std::bad_alloc
&)
47 // allocate an array whose size causes an overflow during addition
52 abi::__cxa_vec_new (std::size_t(-1) / 4, 4, padding
, ctor
, dtor
);
55 catch (std::bad_alloc
&)