testsuite: don't declare printf in coro.h
[official-gcc.git] / gcc / testsuite / g++.dg / coroutines / torture / local-var-00-const.C
bloba8956457dcd3f6ff7dd9b6ef82c377eee2a1e8d9
1 //  { dg-do run }
3 // Simplest local decl.
5 #include "../coro.h"
7 // boiler-plate for tests of codegen
8 #include "../coro1-ret-int-yield-int.h"
10 struct coro1
11 f () noexcept
13   const int answer = 42;
14   PRINTF ("coro1: about to return %d\n", answer);
15   co_return answer;
18 int main ()
20   PRINT ("main: create coro1");
21   struct coro1 x = f ();
22   PRINT ("main: got coro1 - resuming");
23   if (x.handle.done())
24     abort();
25   x.handle.resume();
26   PRINT ("main: after resume");
27   int y = x.handle.promise().get_value();
28   if ( y != 42 )
29     abort ();
30   if (!x.handle.done())
31     {
32       PRINT ("main: apparently not done...");
33       abort ();
34     }
35   PRINT ("main: returning");
36   return 0;