Skip to content

[clang/c++/coroutines] -Wunused-parameter not working with coroutines. #65971

@no-more-secrets

Description

@no-more-secrets

Given some coroutine return type task<T>, the following:

task<int> foo( int a ) { co_return 42; }

when compiled with -Wunused-parameter, will not warn that a is unused. I suspect that it is because a is used during setup of the coroutine frame/promise... but I think most users would not expect that to count as "used."

Actual behavior: no warning.
Expected behavior: warning: unused parameter 'a' [-Wunused-parameter] (when that warning is enabled)

Note that GCC does warn in this scenario. In my coroutine-heavy code base I am thus forced to compile with GCC to find all of my unused parameters.

Metadata

Metadata

Assignees

Labels

clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzercoroutinesC++20 coroutines

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions