<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/126424>126424</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang-tidy] cppcoreguidelines-pro-bounds-pointer-arithmetic generates incorrect warnings re. to std::map::operator[]
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          adesitter
      </td>
    </tr>
</table>

<pre>
    ```
❯ 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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVE2P4zYM_TX0hbBhU_4YH3xwks1piwJ76HUhW4yjri25kpzt9NcXcjKbHbRFMUIQS6QoPT0-UnqvJ8PcQXWA6pTILVyt66Rir0NglwxWvXZQ549f3sMngvYE_RnHWZopDVq9Ypre2HltDeT958-__YJAL9cQVhA90BnoPM-3JbNu2ldtNOc94r71EYlFmxVZudt_XYNe9F-scNj0rLJ47bubZcAlG9cVo5mENuO8KUYQx0WuID5B3gde1lmG3RheVzZyYfxy92kT8AL04oOKUES_Rx2_APVAR9QmxH1UY7TTEaMDHVCL0Bx2hI7D5szurw4OqhOI6IDm9A-sT5aAKE3HK4_fPIhTer9tXNfROp42rXjWhn26OpsOdjPKp6vVJrBLpdPhunDQIxBh-sem-Y2BNIW8rxv8Lp3RZvI4sWEnA99po_N36775VY7sgc76T6DzGL4O2_S1ADrvZ4DoSxB9Ef_ezolTZdHYgJtnfADBJxCE6vBR7NVpJw-xRGiO-J804j7uW34aUMXkvRPjvnyfxjixa6TAuruqoc5RWfa4P0ebm51v__okbeJjHY5WcZaoTqhWtDLhrmhEWxBVokyuXVM3ZSXVS1MNtZJSXdSluVwKKstSiHFQie4opyqnvC0aUYkyUzWruhRtrvIXcWkUlDkvUs_ZW1kk2vuNu4LqkspklgPPfi9Joqd-gCiWqOtiVDpsk4cyn7UP_nlO0GHei_mnsOqEH0zUDw151Ga0zvEYngJznGGw-H-sJ5ubu9gE_I8uMOlw3YZstMujJTw-Ec3vPIYo0EhEVOqDi1tHfwcAAP__sE5v-Q">