tidy - cppcoreguidelines-avoid-reference-coroutine-parameters — Extra Clang Tools 22.0.0git documentation (original) (raw)
cppcoreguidelines-avoid-reference-coroutine-parameters¶
Warns when a coroutine accepts reference parameters. After a coroutine suspend point, references could be dangling and no longer valid. Instead, pass parameters as values.
Examples:
std::future someCoroutine(int& val) { co_await ...; // When the coroutine is resumed, 'val' might no longer be valid. if (val) ... }
This check implements CP.53from the C++ Core Guidelines.