1.. title:: clang-tidy - cppcoreguidelines-avoid-reference-coroutine-parameters
2
3cppcoreguidelines-avoid-reference-coroutine-parameters
4======================================================
5
6Warns when a coroutine accepts reference parameters. After a coroutine suspend point,
7references could be dangling and no longer valid. Instead, pass parameters as values.
8
9Examples:
10
11.. code-block:: c++
12
13  std::future<int> someCoroutine(int& val) {
14    co_await ...;
15    // When the coroutine is resumed, 'val' might no longer be valid.
16    if (val) ...
17  }
18
19This check implements `CP.53
20<https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rcoro-reference-parameters>`_
21from the C++ Core Guidelines.
22