3 /* The simplest valued co_await we can do. */
7 // boiler-plate for tests of codegen
8 #include "../coro1-ret-int-yield-int.h"
16 gX = co_await coro1::suspend_always_intrefprt{t};
22 PRINT ("main: create coro1");
23 struct coro1 f_coro = f ();
24 PRINT ("main: got coro1 - checking gX");
27 PRINTF ("main: gX is wrong : %d, should be 1\n", gX);
30 if (f_coro.handle.done())
32 PRINT ("main: we should not be 'done' [1]");
35 PRINT ("main: resuming [1] initial suspend");
36 f_coro.handle.resume();
37 PRINT ("main: resuming [2] co_await suspend_always_intprt");
38 f_coro.handle.resume();
41 PRINTF ("main: gX is wrong : %d, should be 5\n", gX);
44 /* we should now have returned with the co_return (15) */
45 if (!f_coro.handle.done())
47 PRINT ("main: we should be 'done' ");
50 int y = f_coro.handle.promise().get_value();
53 PRINTF ("main: y is wrong : %d, should be 15\n", y);