<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/121391>121391</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
False positive of lifetime_capture_by
</td>
</tr>
<tr>
<th>Labels</th>
<td>
false-positive,
clang:memory-safety
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hokein
</td>
</tr>
</table>
<pre>
See https://godbolt.org/z/Yb61Pda3W
```
#include <vector>
struct Foo {};
template <typename T>
struct Container {
const T& tt() [[clang::lifetimebound]];
};
template<typename T>
struct StatusOr {
T* get() [[clang::lifetimebound]];
};
StatusOr<Container<const Foo*>> getContainer();
void test() {
std::vector<const Foo*> vv;
vv.push_back(getContainer().get()->tt()); // bogus diagnostic
}
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykk0-PozgQxT9NcbESGRtCcuBAkua6K3VLqz21_KdCPG0wwgVS5tOPCCE906M5jVQSB6j3e6-qUDG6pkMsIT9Cfk7USNcwlNfwga5LdLC3Enj1isiuRH0EWYGoQdRNsDp42oahAVF_B1H_r3fpv1bJ_4BXc-34o3gFQrrO-NEiA3ma0FAYQL4AryINoyFWh8CgOEJxBnlc-gnb3iu6d9Ctx061yN5-6TqFjpTrcLj38ooxE7pI7A3EjhGB2IM4sHuwo_Gqa2b3svLuguRa1GHsLOTnuRbqil_Zf0a_kqIx_vNJnqEVa_AvqKsmyNMzGcjTkqkOAUQ1e5AvM-bzizvvObYpOMsI49PHw18ku_hYp_9Vl03TIsKmaduP8fqulfkAsf8dtn3G3IB8WQe9uGDLeTAdmjEy61TThUjOPIL-dBeJLaU9yINKsEwLme9yyWWRXMtDZq26FNzuDxozI_cmU3J_yLW2dlfkInGl4CJLhUxTmXNZbAurMpNn2Y4rK7k2kHFslfNb76d2PtHExThimYpUHtLEK40-3i9eiIvyETd9iI7chCAEiBMIsW6uxTYMt01UF6Tb_DY_J0M562702ETIuHeR4ieJHHks61mVraosXNi6_3ejehoHfNe3ZBx8-eW3cnQd9daEFkQ9az4em34I39AQiPoeJYKoH2mmUvwIAAD__6ofI94">