https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116482
Bug ID: 116482
Summary: Bogus -Wunused-parameter with C++ coroutines
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: c++-coroutines
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: daklishch at gmail dot com
CC: iains at gcc dot gnu.org
Target Milestone: ---
After 6303cd7e41546e95c436bd274cc972674230fe1c, the following code produces
bogus -Wunused-parameter warning:
```
$ cat ../test.cpp
#include <coroutine>
struct SuspendNever {
bool await_ready();
void await_suspend(std::coroutine_handle<>);
void await_resume();
};
struct Coroutine;
struct PromiseType {
Coroutine get_return_object();
SuspendNever initial_suspend();
SuspendNever final_suspend();
void return_void();
};
struct Coroutine {
using promise_type = PromiseType;
};
Coroutine __async_test_input_basic() {
co_return;
}
$ ~/gcc-15-trunk/bin/g++ ../test.cpp -c -std=c++20 -fno-exceptions
-Wunused-parameter -o /dev/null
../test.cpp: In function ‘void
__async_test_input_basic(_Z24__async_test_input_basicv.Frame*)’:
../test.cpp:24:1: warning: unused parameter ‘frame_ptr’ [-Wunused-parameter]
24 | }
| ^
../test.cpp: In function ‘void
__async_test_input_basic(_Z24__async_test_input_basicv.Frame*)’:
../test.cpp:24:1: warning: unused parameter ‘frame_ptr’ [-Wunused-parameter]
```
CE link: https://godbolt.org/z/q85WMafja