<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/118064>118064</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] No warning on dangling iterator of Set containers
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:memory-safety
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
usx95
</td>
</tr>
</table>
<pre>
All usages are dangling references below:
```cpp
#include <set>
#include <unordered_set>
#include <vector>
void sets() {
auto x = std::set<int>{}.find(1);
auto y = std::set<int>{}.begin();
auto z = std::set<int>{}.end();
}
void sets2() {
auto x = std::unordered_set<int>{}.find(1);
auto y = std::unordered_set<int>{}.begin();
auto z = std::unordered_set<int>{}.end();
}
void vector() {
auto y2 = std::vector<int>{}.begin(); // Only warning here. Good!
}
```
https://godbolt.org/z/Mb4vr31P4
We might be missing `[[clang::lifetimebound]]` on these methods.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJycVEtvoz4Q_zTDZdQIbEjCgQNp_vxP-5D2sMeVjQfwytiRbdKmn34FSdptt9tWK1ni-Xt5PCNC0L0lqqDYQbFPxBQH56sp3JdFIp06VbUxOAXRU0DhCZWwvdG2R08debItBZRk3B3wGtIa1ul5tYfD_Mi4tq2ZFCHw20AR-H9_vJ6s84o8qR9_-eFIbXT-8iWtj04rDBQDsC2wEmGzg7RGRBRTdHiPwPcYopod8XrhvNV2Yd7sYLNfddoqYNsMWAn8Gfb0LlZSr-1Z-AX24V0sLbKPSNjsf0_DPhTnxWb9Y7A3WT4c8U2WV8Ne814q-mrgE3uucq3-WyYRWAOswS_WnPBOeDuf0IE8rfB_5xSw7MnC9YRCWg8xHsKssqB7p6QzceV8D6x5ANZ8kvnR8-xrfrb-nXDU_RBRzjchzCIz0dw6u9YI258dG91R1CNJN1kFxX5e6xSdxThQIBwpDk6FVaIqrkpeioSqbMPZdr3esiwZqjJXBd-Wm5wyLphoGfFSEKlCylaJkie6YinLs4yV6abgebbqMlW2MpProhSdkFvIUxqFNitjjuOcKNEhTFRl2TZd54kRkkxYmp6xq_ORRudPN0F0FE_A2DwPfDUT3MipD5CnRocYniijjmaZHGeGYo-f3ePuO_s0K3QkL6Lz6Dr8RhFbZ6PQlnxIJm-qF2XQcZjkqnUjsGbWulxuDt79pDYCa5YsAVhziXOs2K8AAAD__50wa4I">