llvm / llvm/llvm-project

[clang-tidy] misc-coroutine-hostile-raii cannot detect hostile types inside containers

Open
#187,024 4 comments 0 reactions 0 assignees View on GitHub
clang-tidy false-negative
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

There's currently no way to make `Container` raise a warning:
```c++
Task SampleCoro() {
{
MyRaiiType v;
co_await std::suspend_always{}; // OK, warns here
}
{
std::optional v;
co_await std::suspend_always{}; // No warning
}
}
```

https://godbolt.org/z/e4onKdj16

Contributor guide

Open the contributing guide

Research direction

Start with the clang-tidy misc-coroutine-hostile-raii check and reproduce the example from the linked Godbolt case. Trace how the check handles MyRaiiType across co_await, then extend the investigation to std::optional and other ContainerHostileType cases. Done means hostile RAII types nested in containers produce the expected warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.