| 1 |
// { dg-do run } |
| 2 |
// { dg-skip-if "requires hosted libstdc++ for cstdlib abort" { ! hostedlib } } |
| 3 |
|
| 4 |
/* check the code-gen for the failed alloc return. |
| 5 |
Here we use an allocator that doesn't fail so that the code |
| 6 |
is generated, but the regular path is run. */ |
| 7 |
|
| 8 |
#define PROVIDE_GROOAF |
| 9 |
#include "../coro1-allocators.h" |
| 10 |
|
| 11 |
int used_grooaf = 0; |
| 12 |
|
| 13 |
struct coro1 |
| 14 |
f () noexcept |
| 15 |
{ |
| 16 |
PRINT ("coro1: about to return"); |
| 17 |
co_return; |
| 18 |
} |
| 19 |
|
| 20 |
int main () |
| 21 |
{ |
| 22 |
PRINT ("main: create coro1"); |
| 23 |
struct coro1 x = f (); |
| 24 |
if (used_grooaf) |
| 25 |
abort (); |
| 26 |
|
| 27 |
PRINT ("main: got coro1 - resuming"); |
| 28 |
if (x.handle.done()) |
| 29 |
abort(); |
| 30 |
x.handle.resume(); |
| 31 |
PRINT ("main: after resume"); |
| 32 |
if (!x.handle.done()) |
| 33 |
{ |
| 34 |
PRINT ("main: apparently not done..."); |
| 35 |
abort (); |
| 36 |
} |
| 37 |
PRINT ("main: returning"); |
| 38 |
return 0; |
| 39 |
} |