<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/136105>136105</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] False positive bugprone-use-after-move with std::tie
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy,
false-positive
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dmpolukhin
</td>
</tr>
</table>
<pre>
Minimal reproducer https://godbolt.org/z/PoboWj4PM:
```c++
#include <tuple>
#include <utility>
#include <string>
std::pair<std::string, std::string> foo(std::string a, std::string b) {
return std::make_pair(std::move(a), std::move(b));
}
void bar(std::string a, std::string b) {
std::tie(a, b) = foo(std::move(a), std::move(b));
std::tie(a, b) = foo(std::move(a), std::move(b));
}
/**
test.cpp:11:34: warning: 'a' used after it was moved [bugprone-use-after-move]
11 | std::tie(a, b) = foo(std::move(a), std::move(b));
| ^
test.cpp:10:24: note: move occurred here
10 | std::tie(a, b) = foo(std::move(a), std::move(b));
| ^
test.cpp:11:48: warning: 'b' used after it was moved [bugprone-use-after-move]
11 | std::tie(a, b) = foo(std::move(a), std::move(b));
| ^
test.cpp:10:38: note: move occurred here
10 | std::tie(a, b) = foo(std::move(a), std::move(b));
| ^
**/
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzEVU9voz4Q_TTDxUpkxhDgwIEm5Vapt9_xJ4NN4tZg5D-pup9-Zcr2T9rVqqvtbmTJimf03rznwcOdU8dJyhryK8gPCQ_-ZGwtxtnocH9SU9IZ8VjfqEmNXBMrZ2tE6KUlJ-9nB6wBbAHboxGd0X5r7BGw_QbY3prO_HeX3d7EHNrAjj6tHvAqLtoAMjX1OghJgO19mLUEdv0uELzSyj9-FHLequm4RmjjvIhkrJm5skt4_b_m4Z5cHrFrMhgDWF4ECP8gm3SAFYEiFk-IlT7Y6SVn5Pfy_4X5FdpozhKw5IDVG8D1vFvOK2CLH8XhScfZKEE6bn-rrOegVyvzfk1gh0utn6nuy4CfZS-d1MRFGy-d3_bzDKxJU2ANy4A15IHbabm1hgAWHLAgwUlB-OClJcqTB-5I5BAE8qsuHGdrJrkJTm6WlM3Cnx8Wo0iaEij2X2fY8osMkF9fSKLAGlwkTcbLuEcEYvo-WCsFOUkr1yLpPysy-p6V733v_ozvX9iqv3CelZ9w_u-VuTY_tq-fy6dPIxE1ExWreCLrtMiysiizXZWc6jLrq7KoBsE6WeZ5VQxUVEO5K_KK8V0pElUjxZxmaUFLLLJqK4cKd-nA05QymmU7yKgcudJbrc9jfL8T5VyQdcp2Kc0TzTup3TIeEHvNp-PGK_EIiIB7QBy4dnIzG6e8ihIxThFbR7BNF44OMqqV8-4F3iuvl3nzCi0_kDYCkR9A5CdNRB6UP725kSRYXV8MI-VPodv2ZgRsI--6bWZr7mTvAdtFowNsV5nnGr8HAAD__x4LAUM">