Issue |
126424
|
Summary |
[clang-tidy] cppcoreguidelines-pro-bounds-pointer-arithmetic generates incorrect warnings re. to std::map::operator[]
|
Labels |
clang-tidy
|
Assignees |
|
Reporter |
adesitter
|
```
❯ clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 19.1.4
Optimized build.
❯ cat m.cpp
#include <map>
template <typename R>
int f(std::map<R*, int>& map, R* r) {
return map[r];
}
❯ clang-tidy "--checks=-*,cppcoreguidelines-pro-bounds-pointer-arithmetic" -quiet m.cpp --
67 warnings generated.
/workspaces/ix/ct_bug_1/m.cpp:4:14: warning: do not use pointer arithmetic [cppcoreguidelines-pro-bounds-pointer-arithmetic]
4 | return map[r];
| ^
```
`std::map::operator[]` does not involve pointer arithmetic in user code.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs