Issue 175731
Summary [clang-tidy] readability-qualified-auto suggests to add a * that breaks compilation in other compilers
Labels
Assignees
Reporter tsdgeos
    With the following code

```
#include <array>
#include <ranges>

int main(int argc, char *argv[])
{
    std::array<int, 16> myArray = {};

 auto it = std::ranges::find(myArray, 3);

    if (it != myArray.end()) {
 printf("FOUND!");
    }
}

```

It says

```
main.cpp:9:5: warning: 'auto it' can be declared as 'auto *it' [readability-qualified-auto]
    9 |     auto it = std::ranges::find(myArray, 3);
      |     ^~~~
      |     auto *

```

But if you add the * and try to compile it with MSVC it fails https://godbolt.org/z/csoe57Kea

Reading https://en.cppreference.com/w/cpp/algorithm/ranges/find.html I woud not expect that it to have a *
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to