<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/81613>81613</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] false-negative for `cppcoreguidelines-prefer-member-initialization` when initializing in the ctor body with temporary expressions/exprs with cleanup
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
5chmidti
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
5chmidti
</td>
</tr>
</table>
<pre>
Given
```c++
struct StructWithCtor {
StructWithCtor(int x, int y) {}
};
struct AssigningFromTemporary {
AssigningFromTemporary() : M{1, 2} { M = StructWithCtor{1, 2}; }
StructWithCtor M;
};
StructWithCtor createTemporary();
struct AssigningFromTemporaryFromFunction {
AssigningFromTemporaryFromFunction() : M{1, 2} { M = createTemporary(); }
StructWithCtor M;
};
```
No diagnostics are emitted (https://godbolt.org/z/6GPYafvbd).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU9FuozoQ_ZrhxUoEdgLkgYekiD716kr3Sqt9NGaAWRkb2SZt-vUr02w2G6naSpaMx2dmzvFwpPc0GMQK9ifgfK_GibpAwDns60QuYbSu-hVNWttdqmc6o4G0hvQIefqxFPBTXGvUB7eowP5bt28UxqdgHYPies0eboCXZAJ7A_7E4scF-GFFF_W1S1GD-LP2caVNZmicnf7HabZOust9D_YJBni51hdH9gLFKYtdORR1zGUvDET9SO8OBOLEbrRijweNLzee95wfQMqhDPhA6GsC46FZjApkzZ3Yv4O_oPozWneCv6T29k98HP-xrCM5GOsDKc-kQ4YThYAdA16OIcwexBF4A7wZbNdaHbbWDcCbd-BN_vzvd9mf2w74YZt0legO4iATrLIiLUpR8iJLxirrUWGfcnXAPhWp6vOiKMVOqDaXqepEQhVP-S7lmcj2IsuybdfuD9hncqf6vCxkC7sUJ0l6q_V5iv0T8n7BqszyTCRatqj91SJKSzNsAnWXq0lcFZM27TJ42KWafPC_ywQKejXXXdq-Zr3UHjcGBxnojKyP_shTNc_KOhwW6lCTQb-ZHfboNhNOLboNGQokNb3LdaZ5yl5HNOwWJjMwMiyMyFQcULQre6UwsnCzCL7NDr0nazzwJp78B0RplGaZk8Xp6mEsFMal3So7AW-isuu2mZ39gSoAb9bXigXXB_sZAAD__2B4XIo">