<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64213>64213</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Add check for `std::map` like ordered container with pointer as key
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zufuliu
</td>
</tr>
</table>
<pre>
```c++
#include <cstdio>
#include <map>
struct Foo {
int bar;
};
void dump(const std::map<Foo *, int> &dict) {
for (const auto [foo, value] : dict) {
printf("%d, %d\n", foo->bar, value);
}
}
```
It's bug prone, as iteration order is non-deterministic.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsUltuwzgMPA39IyRQKD8__JFHA-wxZElOuHUkQ6JadE-_kPsGChCmTWKGniF1SnTzzo3QnKC5VDrzPcTxvzznhXI1Bfs2QivfwwCeSsgLyCOgIm-WbJ0AdTaJLQVQT381H3r97mzPxDEbFtcQBHSfhHIgz2LSEdQJ5PBR7S7b5zf2JZAVNj9WwN4En1gktqCOoI7boPPGikfAsyDPoJ4EYGvJMODwa9wcovgi0ZmDgOY0h1CQL3rJDpqLAHUUf4FBDmskzzNgD4iAjS24LTdnv5XOYg5hB-qpiPoixeGHoqEI_FL6_vLp90_V_zBgl8SUb2KNwbtCp5MgdlEzBS9CtC4KSsIHv7OOXXyQp8Rk9pUdlR3UoCs3HtpBNn1_wL66j53qtD1MHTa2trKfVW0GYzX2qj-4fporGlGikh32qOq-7vdWzShb01vZKdlNA9TSPTQt-2V5eexDvFWUUnZjW-NBVYue3JK220L07lVszWJNc6niWDC7Kd8S1HKhxOmbhYmX7SjNov1tx2TfyjKO1gpzd-ZZbLtr5a_Vt1Is9OzerXBWmOBZk3dRvBLfxRrIs4vFtmf3VuW4jHfmNRUCvAJeb8T3PO1NeABey698pN0aw7-unMB1E5AAr5vA_wMAAP__2RjyuA">