<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/68101>68101</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] performance-noexcept-move-constructor and performance-noexcept-swap do not handle conditional noexcept properly
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jpboivin
</td>
</tr>
</table>
<pre>
Hello,
I've tested clang-tidy 17 on some codebases, and there seems to be false positives (except if I'm missing something) with `performance-noexcept-move-constructor` and `performance-noexcept-swap` checks, at least in templated code that annotates the move constructor or swap with a conditional `noexcept` (when using traits, otherwise it is properly handled).
I've written an extremely simple piece of code that triggers the issue:
https://godbolt.org/z/59EhaEeda
```
[<source>:7:37: warning: noexcept specifier on the move constructor evaluates to 'false' [performance-noexcept-move-constructor]](javascript:;)
7 | Container(Container&&) noexcept(std::is_nothrow_move_constructible_v<T>);
| ^
[<source>:8:42: warning: noexcept specifier on swap function evaluates to 'false' [performance-noexcept-swap]](javascript:;)
8 | void swap(Container& other) noexcept(std::is_nothrow_swappable_v<T>);
| ^
2 warnings generated.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUlMtu8zYQhZ9mvBnYkEnrttDCcWK0--4DihpLTClSIEf2nz59QSm3Bn8A1xBkCxbnzHw8PCpG0zuiBvIHyB83aubBh-Zlar25Grdpfffa_EHWehAnyB4hO673P0GUV0KmyNShtsr1WzbdK-5L9A6jHwm176hVkSKIEyrXIQ8UCCPRGJE9toQXZSPh5KNhc6WIICr6pWliNBdMGiOOJkbj-qUkD8b1IGq8GR4QimyicPFhVE7T1vl16Xb0V9pq7yKHWbMPUGSL_E_vx5ua0jt6IP332iyjJRUZjUOmcbJqmdJ3hDwoRuWcZ8UU00iY9PCLHvqAqebapUp_dYaNd8qmHt51kySI6jaQw3kZkYMyvDTgE6qbiYSG0UScgp8o2FcclOssdSDq3W-24xYMMzlUDukXBxrJvmI042QJJ0Oa0F--jMHB9D2FdQoT40wg3woOzFNMT-IM4tz7rvWWdz70IM7_gDjn9dOgnqhTX7uAInu71sf8AeQp-jloAvkE8liCPMp0w5sKLu2lPOI7D4wTaXMxFJKDfguWrsrOK3ePIMrFPiBKhPzhPivkj-kS1Yu6qqiDmTgNKR9A1GvTiIglQnnCk3esjKMAovryu1iu-qNtEFXkbqlyNPHZeR6Cvz0n5ecPZdNaer6CPP2VQIg6Ka5ySemeD-RPP1GtQB4P4i6qiy0vs9PJjv8f53JS7kJYfQx29aZbdL9hXD1-B8m0dlI_AlzplKdPQuKdQ8SeHIV0eHffHLrpGtnVslYbavZFXUhZF0W2GRpJddbldZHnmdAHQYd8XwlZHg4F0V7VxcY0IhNyn2VyL0V5yHaX6nJRrVS6PMhSixwOGY3K2J211zEdmc1ytJqi2mf7jVUt2bjkrRCfuQlCpPwNTVq0bec-wiGzJnL8LMOG7ZLUX5blj3iX8ZcA_HFPsfPoPL-ly38C68NH7xG0mYNtvsWD4WFud9qPIM6p3bev7RT8C2kGcV4QRBDnhcK_AQAA__8v3hdD">