Debian Codegraph @

gcc/testsuite/g++.dg/coroutines/coro-missing-promise.C

raw
1 // { dg-additional-options "-fsyntax-only -w" }
2
3 #include "coro.h"
4
5 // Diagnose completely missing promise.
6
7 struct NoPromiseHere {
8 coro::coroutine_handle<> handle;
9 NoPromiseHere () : handle (nullptr) {}
10 NoPromiseHere (coro::coroutine_handle<> handle) : handle (handle) {}
11 };
12
13 NoPromiseHere
14 bar ()
15 {
16 co_yield 22; // { dg-error {unable to find the promise type for this coroutine} }
17 co_return 0;
18 }
19
20 // check we have not messed up continuation of the compilation.
21 template <class... Args>
22 struct void_t_imp {
23 using type = void;
24 };