<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64361>64361</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] cppcoreguidelines-owning-memory fails to cope with new expressions with cleanups(temp var to destroy)
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
qqiangwu
</td>
</tr>
</table>
<pre>
```C++
#include <string>
void Foo()
{
std::string* s = new std::string(); // A
std::string* t = new std::string("abc"); // B
}
```
cppcoreguidelines-owning-memory only complains aboue case "A"

The reason is:


</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0k9GOmzoQhp9muLEcmTFgfMFFsjl5gvMCxp4lPnIwi83m5O0r2KRNW2mrXiyyDGI0v7_fM2NS8sNI1EF9gPpYmCWf49y9vXkzDtel6KO7ddCIj_UCeFiXOILYA0o_2rA4YiBfUp79OID85x7c9vfoHTvFCNgC6ntEPfKFTtmB3IPc37NxzxIDeWQjXdlvwU1DHtjPD-AJ8MT2n4nmT0XR9BYQn9Xvog9Sdbx_PC7i2aSdJhtnGhbvKPiREo_X0Y8Dv9AlzjcWx3BjNl6mYPyYmOnjQsyaRAwQ9-vBT2KAJdQHfzEDQX0EbM85T2lF3ogGn89Lv7PxAngK4f3x4tMc_yObAU8mJcoJ8IStxlIowJPthWttXXOtyfCqahTXZdlwVwlVGtHWSjzVZ9v_PRObyaQ4Mr8d_3V0lVOyl73gRlnilRCOa5TElaVeWd2TbOkXuq_haGpElIKb0jleVaS5QZKcGmN7bFTv6v47R-E66bTUpqCubHQpUNdKFOdOvLYttlZVrq5IkS5radGhtVa8tqpuC9-hQClaIQViU4qdcWSaRqBt0JSVc1AJuhgfdivyLs5D4VNaqGsq2ZRFMD2FtI0r4trRW3DtovpYzN1ms1-GBJUIPuX0QyX7HLY5t8GMA8_e3aA-sj-1L3s1PiSWI7NxInb1-bxNEv0_zZSSj2P6-GkDmXGZEmCb6TKxdzOvWY5SnuMNUBfLHLq_rtTmb63U5v9bAAAA__-oQGCo">