llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[Clang] -Wunused-parameter is not emitted for coroutines with class-specific operator new

Open zhscn opened this issue 3 months ago • 3 comments

https://godbolt.org/z/Kh68nahxq

zhscn avatar Aug 20 '26 01:08 zhscn

I'd like to work on this.

It appears that collectPlacementArgs() calls BuildDeclRefExpr() for each coroutine parameter during class-specific allocation-function overload resolution, marking the parameters as referenced without restoring their original state and thereby suppressing -Wunused-parameter.

Lane0218 avatar Aug 20 '26 02:08 Lane0218

I'd like to work on this.

It appears that collectPlacementArgs() calls BuildDeclRefExpr() for each coroutine parameter during class-specific allocation-function overload resolution, marking the parameters as referenced without restoring their original state and thereby suppressing -Wunused-parameter.

Note, we don't assign issues until there is a PR and we verify it is making progress.

shafik avatar Aug 20 '26 02:08 shafik

I'd like to work on this. It appears that collectPlacementArgs() calls BuildDeclRefExpr() for each coroutine parameter during class-specific allocation-function overload resolution, marking the parameters as referenced without restoring their original state and thereby suppressing -Wunused-parameter.

Note, we don't assign issues until there is a PR and we verify it is making progress.

Hello, I've opened a PR with a fix: https://github.com/llvm/llvm-project/pull/217518. It preserves each coroutine parameter's referenced state while collecting placement arguments and adds regression coverage for -Wunused-parameter.

Lane0218 avatar Aug 20 '26 03:08 Lane0218