<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97471>97471</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
-Wdangling warning on `std::unique_ptr<int>(nullptr).get()`.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:frontend,
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
hokein
</td>
</tr>
</table>
<pre>
This is an interesting case:
```
const int* p2 = std::unique_ptr<int>(nullptr).get();
```
Clang emits a `object backing the pointer will be destroyed at the end of the full-expression` warning. For this case, we know that the result `p2` is `nullptr`, this is not a dangling case.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycUk2O2zwMPY28IWLIsuOfhReZ5MsJPqDLQpYYWx1FckV60rl9IU-m7aKrAgJFiXwk3wM1kZsD4iiOL-J4KfTGS0zjEl_RhWKK9n38f3EEjkAHcIExIbELMxhNKOqTkBchP20rn2d_mhiIM0aoE6wKRH0BYptB9WkL7vuGX1dOoj7nnPo_ofqweZ-_1FDOyEL1Qg2ifgH4a4MPe_Y6zIB3xwQaRCvj9A0Nw6TNax6UF4Q17qPDw3kPE4JF4hTf0YLmPQGDhXjb3dvm_QF_rAmJXAyilfDQKbgwl3CNCTjrsbNXZ3ggvIb4AF6ehRLS5jmPsaoMdZT9T16tzCB-Khoigwarw-w_FS0LO9Z2qAdd4Fh11TAcZdP1xTIORpvWtqil6QacGovVrWmUbo1p5dBXhRuVVI3spFJSVlVbSmt6adoB-_527E0nGol37Xzp_du9jGkuHNGG49A1XVV4PaGnfQ-UMllTUZ9uKQbGYIVSQp3_CFin5xCJnaEcO16KNOayh2mbSTTSO2L63YgdexwPX35xfSoKMWR5_mUrWlkWW_LjwrxSRqurUNfZ8bJNpYl3oa65_fM6rCnmrRDqupMmoa4fvN9G9TMAAP___Rjy2A">