<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/99685>99685</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[[gsl::Pointer]] does not diagnose dangling-after-copy
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pkasting
</td>
</tr>
</table>
<pre>
[[gsl::Pointer]] can be used to diagnose a limited set of dangling pointer issues. However, it does not seem to preserve lifetime info through copies; see https://godbolt.org/z/vfjojda7K. Since the docs say a class so annotated "behaves like a pointer into the owner", it seems like copied "pointer"s should also dangle when the original owner is destroyed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8ksGOm0wQhJ9muLSMcANrc-Cw-1vol3KJlCcYZhqY3fE0mh6wnKePMI4j5ZATB6iPqq7SIm4MRK2qP1R9yfSSJo7t_KUluTBmPdv7_u5jFK_Kd1W-f2cXEkVVX1R9AaMD9ASLkIXEYJ0eAwuBBu-uLpEFoQQ8gNVh9C6MMO96cCILSQ7_841Wigr_A5fAMgkETiBE1404RxKKK4F3AyV3JXBhYEhT5GWcwPDsSFT5sQlgSmmWzSZ2CruRbc8-5RxHhd1Phd06fPKn1advOfxwwRCkicCyERB9Bw3GaxEQBh0CJ73ZV4g9TXolAe--tmCvACHxA8C3sPnHZ4TN-fPjh7sH4ylSiAIy8eItaC-8n4XgNlHYWdGNLmi_Q8EJWJIU-U42z2xb2qZsdEbt8YTH6lidqjKb2jejbV0VdVk32qCxtmiG8wlrcyyHc9nYzLVYYFWcjs3xXNUV5qirAk_a2ALxrShqVRV01c7n3q_X7WDZo562ad7OdeZ1T14eQ0AMdNu72xLXlyy2m-bQL6OoqvBOkvyhJJc8_XtBr8Zf2_k9lYMeEsWD4fmeLdG3f7Xr0rT0ueGrwm774fNxmCN_kkkKu31iCrs9xtrirwAAAP__HlH6pg">