Debian Codegraph @

gcc/testsuite/g++.dg/coroutines/pr95518.C

raw
1 // { dg-additional-options "-O -Wunused-function" }
2
3 #if __has_include (<coroutine>)
4 #include <coroutine>
5 using namespace std;
6 #elif defined (__clang__) && __has_include (<experimental/coroutine>)
7 #include <experimental/coroutine>
8 namespace std { using namespace experimental; }
9 #endif
10
11 struct dummy
12 {
13 struct promise_type
14 {
15 dummy get_return_object() const noexcept { return {}; }
16 std::suspend_never initial_suspend() const noexcept { return {}; }
17 std::suspend_never final_suspend() const noexcept { return {}; }
18 void return_void() const noexcept {}
19 void unhandled_exception() const noexcept {}
20 };
21 };
22
23 // This checks that the attribute is passed on to the outlined coroutine
24 // functions (so that there should be no diagnostic).
25 [[maybe_unused]] static dummy foo()
26 {
27 co_return;
28 }