1 //  { dg-do run }
2 
3 /* check the code-gen for the failed alloc return.
4    In this case, we use an operator new that always fails.
5    So the g-r-o-o-a-f should fire.  */
6 
7 #define PROVIDE_GROOAF
8 #define USE_FAILING_OP_NEW
9 #include "../coro1-allocators.h"
10 
11 int used_grooaf = 0;
12 int used_failing_new = 0;
13 
14 struct coro1
f()15 f () noexcept
16 {
17   PRINT ("coro1: about to return");
18   co_return;
19 }
20 
main()21 int main ()
22 {
23   /* nest a scope so that we can check the counts.  */
24   {
25     PRINT ("main: create coro1");
26     struct coro1 x = f ();
27     /* we don't expect to be able to do anything.  */
28     if (used_failing_new != 1)
29       {
30 	PRINT ("main: we should have used the failing op new");
31         abort ();
32       }
33     if (used_grooaf != 1)
34       {
35 	PRINT ("main: we should have used the GROOAF");
36         abort ();
37       }
38   }
39   PRINT ("main: returning");
40   return 0;
41 }
42