Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang-tidy] Duplicate includes modernize-use-ranges #110595

Open
felix642 opened this issue Sep 30, 2024 · 0 comments
Open

[clang-tidy] Duplicate includes modernize-use-ranges #110595

felix642 opened this issue Sep 30, 2024 · 0 comments

Comments

@felix642
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant