<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/110595>110595</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Duplicate includes modernize-use-ranges
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
felix642
</td>
</tr>
</table>
<pre>
After applying the fix-it for `modernize-use-ranges` the include for the header `<algorithm>` appears twice.
For example this code :
```
#include <vector>
#include <algorithm>
#include <iostream>
void foo()
{
std::vector<int> my_vector = {1, 2, 3, 4, 5};
auto min_max = std::min_element(my_vector.begin(), my_vector.end());
}
```
becomes the following after the fix-it:
```
#include <algorithm> // <-- Duplicate header
#include <vector>
#include <algorithm>
#include <iostream>
void foo()
{
std::vector<int> my_vector = {1, 2, 3, 4, 5};
auto min_max = std::ranges::min_element(my_vector);
}
```
godbolt: https://godbolt.org/z/6b4Pcnv5W
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkVE2PozAM_TXmElFRh88Dh047nPe2x1EgBrIKBJHQaefXr0LpTHdV7e59JWSIHftZfg8La1U3EpWQvEByCsTiejOXLWl1SWMMaiOv5aF1NDMxTfqqxo65nlirLqFyrDUzgzQajKR5VB8ULpbCWYwdWUij9aYaG71IWq_6c09C0poF_Ch0Z2bl-gH4q08Q00Ritsy9q4Z2EJ0gOtxsZWZGFzFMmpjrlWWNkcSAH9h2K42253ZEfgcGfjxT48zsMZ4Ef-nhSVwZ62YSD-HVno2SrDUGMAcstkj2cvtgjDHrJPAD8MMd_ahGB_yVDde3m4sBPzHIXvaAR4becG9ibxLITsAfyonFGTao8W0QlzXxs753kqaBRgeYf1bf1dSpcWsPj1-wOxrl3V18Yni8p5NcbU2NGcjeuDdam3evBLEK40sPvp-_s_E4cAZYAVbeHYbstExaNcLdVfL_cbn9O3_i9d9J64ysjfassN65aS27jnsL7MzcAVYfgFVax9-a8Zx8D2TJZcELEVC5zzDLeBojBn2JTYNtmkdFE9O-SOo83ouMZJ3IrM2KJA9UiRHGUcEjxDiLcIc8lkma8rpN2izPW4gjGoTSO63Pg8cOlLULlft9lBRJoEVN2q6LCLHRYuxCp-QVEP1imkufFdZLZyGOtLLOftVxyul1hT2kJacHOW0SsOzZpgqWWZe_DUi5fql3jRkAKw-zvcJpNj-ocYDV2rsFrLb2zyX-DAAA___j2ZHL">