<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/97790>97790</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Question about static analisys (long lived coro references)
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          kelbon
      </td>
    </tr>
</table>

<pre>
    Is there are (or will be) clang diagnostic for coroutine frame "long lived outside references"?

Here what i mean:

```cpp
// case 0: coroutine args
// coroutine_lifetimebound handles this, it cannot be handled on declaration, how this attribute tries to do,
// i think it should be more like clang::noescape
coro_t foo(int& i) {
  co_await bar();
  use(i); // possible UB, 'i' destroyed
}
// case 1: frame reference to outside
coro_t foo() {
  // map is outside of coroutine frame (or someone have references to it outside of coroutine frame) and not global constant
  auto& i = map[key];
// real co_await, e.g. not (await_ready == always true
//                                     || await_suspend always return false
//                                     || await_suspend always returns same handle which is accepted)
  co_await bar();
  use(i); // possible UB, someone deleted map[key] while coroutine was suspended, can happen even with single thread
}

```

In other words, will it be detectable sometime? Reference or reference like type (string_view. something which includes reference like type as member etc) which is created before suspension point and from source, which is escaped from coroutine frame somehow and used after it?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VcGu6jYQ_RqzGT0UHCCwyOLei1DfspW6vprYQ-Jex47sCYi_ryYBCq9PVRctQiDZnuPjc47HmLNrA1GtNu9qc1jgyF1M9Rf5JoZFE-21_p6BO0oEmAiU3sUEF-c9NKT0HozH0IJ12IaY2Rk4xQQmpjiyCwSnhL1UaR9DC96dyUIcOTtLkOhEiYKhrLRW5VEVB1W8zb-_yIaXDhkc9IRBlW_P02pbzF8zDLcRfVT6CAYzQaHKtycOmNr8uug-9endidj11MQxWOgwWE9yXJeV_gDHYDCEyNDQbdJCDGDJeEzILgZZ1sXLVALInFwzMgEnJzgRbFT642VzJ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