<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/117680>117680</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Support use of clang::lifetime_capture_by in constructors
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:memory-safety
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
usx95
</td>
</tr>
</table>
<pre>
https://godbolt.org/z/KqM3znMhT
```cpp
struct S{
S(const int& s [[clang::lifetimebound]]);
};
struct T{
T(const int& t [[clang::lifetime_capture_by(this)]]);
};
void foo() {
S s(1); // Error. Good.
T t(1); // No diagnostic here. Bad.
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8kk9vnDAQxT_NcBkFmTEs5sCB1ZYeqvSye48MGHAFmPrPqptPX8FulChVKo1kHzy_55n3pHN6WJQqITtCdopk8KOxZXB_iixqTHcrR-9XB7wCqoHqwXSNmXxs7ABUvwLVP34_89flebwAq-DA7tWuK7DKeRtaj2fIj8AqRMQzkGjN4jzqxQMd0OEufGwnuQybCq8m3SuvZ9WYsHSQnbaiAvjGgPx0vzzQl3f05TPaf41-aeXqg1UvzQ1I-FG7TeELKWDV1egOe2OABFCBH-ZBBySSexPeV4TfrDU2xu_GdPHb59D_--6nwU7LYTHO6xZHZVWMR7n3bOIf1hl1Je8KXshIlUnO6cAE41k0lmnb9HmXyT7teJEImbOW8z5JBAlKi54iXRKjNEn2FsbTOBOsLUSTScFzdshzSJmapZ7iabrOm62Rdi6oMknyg2DRJBs1uT0dRG-bnNVs7O3JyV75GxBtwbHlBnhqwuAgZZN23r0jvfaTKs9hXY31GJxC0-P_fUG94G7n5rOxLgp2-pxF7cfQxK2ZgepN63E8rdb8Uq0HqvdZHFD9GOda0t8AAAD__3aX3sw">