3 // Basic check of co_await with an expression to await transform.
7 // boiler-plate for tests of codegen
8 #define USE_AWAIT_TRANSFORM
9 #include "../coro1-ret-int-yield-int.h"
16 gX = co_await 11 + 15;
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 [1] await");
38 f_coro.handle.resume();
41 PRINTF ("main: gX is wrong : %d, should be 26\n", gX);
44 /* we should now have returned with the co_return (26+16) */
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 42\n", y);