Debian Codegraph @

gcc/testsuite/g++.dg/torture/pr111773.C

raw
1 // { dg-do run }
2
3 #include <new>
4
5 void* operator new(std::size_t sz)
6 {
7 throw std::bad_alloc{};
8 }
9
10 int __attribute__((noipa)) foo ()
11 {
12 int* p1 = static_cast<int*>(::operator new(sizeof(int)));
13 return 10;
14 }
15
16 int main()
17 {
18 int res;
19 try
20 {
21 res = foo ();
22 }
23 catch (...)
24 {
25 return 0;
26 }
27
28 if (res != 10)
29 __builtin_abort ();
30 return 0;
31 }