1 //  { dg-additional-options "-Wall" }
2 
3 #include <coroutine>
4 
5 #if 1
6 // with a struct, GCC emits "statement has no effect"
7 struct S {};
8 #else
9 // no warning with built-in types
10 using S = int;
11 #endif
12 
13 S Func1(int);
14 
15 struct C {
co_awaitC16 	auto operator co_await() {
17 		struct Awaitable final {
18 			bool await_ready() const { return true; }
19 			std::coroutine_handle<> await_suspend(std::coroutine_handle<>) { return {}; }
20 			int await_resume() { return 42; }
21 		};
22 		return Awaitable{};
23 	}
24 };
25 
26 struct Task {
27 	struct promise_type {
initial_suspendTask::promise_type28 		auto initial_suspend() { return std::suspend_always{}; }
final_suspendTask::promise_type29 		auto final_suspend() noexcept { return std::suspend_always{}; }
get_return_objectTask::promise_type30 		void get_return_object() {}
unhandled_exceptionTask::promise_type31 		void unhandled_exception() {}
32 	};
33 };
34 
Func2()35 Task Func2() {
36 	Func1(co_await C());
37 }
38