1 // Testcase for overflow handling in operator new[].
13 void *operator new[] (size_t sz)
17 throw std::bad_alloc();
28 } catch (std::bad_alloc &) {
34 test_noopt (size_t s) __attribute__((noinline));
49 test<T>(size_t(-1) / sizeof (T) + 1);
50 test<T>(size_t(-1) / sizeof (T) + 2);
52 test_noopt<T>(size_t(-1) / sizeof (T) + 1);
53 test_noopt<T>(size_t(-1) / sizeof (T) + 2);
60 (void) ::operator new(size_t(-1));
62 } catch (std::bad_alloc &) {
64 all_tests<without_new> ();
65 all_tests<with_new> ();