<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/115842>115842</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Improve modernize-use-emplace: warn about local variables that are only passed to push_back()
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chrchr-github
</td>
</tr>
</table>
<pre>
~~~c++
#include <vector>
struct S {
S(int i, int j) : a(i), b(j) {}
int a, b;
};
void f(std::vector<S>& v) {
const S s(1, 2);
v.push_back(s); // warn
}
~~~
https://godbolt.org/z/nKxPhhPo9
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxcksGO2yAQhp9mfBklMoOdmIMP2U0tVb2stA9QYWBjtsREgN3uHvzsFU7SrCpZeKSf_-djGBmjPY3GtFA_QX0s5JQGH1o1BDWEzcmmYeqL3uuPdlkWBfSUv_II5QGI21G5SRsE_jwblXwA_u0mrmtMYVIJXxH2NxMi4itQY8eEFugZc_EOJBD4AWVWgEQWeqDmKuyfYH982LNDXnfwO8r--KjXdfZW4xtQE5MGfgB-uAM-v2ZI2uF8D_-XrPwYM20Ealg-gTLLPRjn7WWKw89eql85-KohUAfU4W8ZxgfMWizLci2GlC4xU6xbT1733qWtDyeg7hOoG3_8eRmGFy8K3XItuJCFadmes6qsxI6KoSVGoixN3Wihq6reKa1rKaRmJWu04vvCtlRSxRijUlSC2FZWjBN_o7qqS76TCqrSnKV1W-fmcz67sDFOpmWsbioqnOyNi-sQECknx9MmWf0BRHkoQptdm346RahKZ2OKj5xkk1vH54utPuL38yX42eDZaxNG-2k2UzQbc744qUx-7NwxlL2fEjqvpMNZBit7ZyKmQSaUwaAf3QdeZIxGY_L4tf9AopiCa_9r7jqwW-XPQF1GvP02l-DfjUpA3XrvCNTdrj639DcAAP__ERHi_g">