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

    <tr>
        <th>Summary</th>
        <td>
            [libc++] Potential bugprone-use-after-move in std::map
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            libc++
      </td>
    </tr>

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

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

<pre>
    See review https://reviews.llvm.org/D67086

```
 template <class _Key, class _Tp, class _Compare, class _Allocator>
 _Tp&
 map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
 {  
+     // TODO investigate this clang-tidy warning.
+     // NOLINTNEXTLINE(bugprone-use-after-move)
      return __tree_.__emplace_unique_key_args(__k,
 _VSTD::piecewise_construct,
 _VSTD::forward_as_tuple(_VSTD::move(__k)),
 _VSTD::forward_as_tuple()).first->__get_value().second;
}
```
As @ldionne mentioned "Can you file a Github issue and link it here? In the issue you can say something like "we have a potential use-after-move in map::operator[]" and link to https://godbolt.org/z/e1x9c1h6Y."
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVN-PozYQ_mvMyygI7ATIAw_5salWPe1WuqhqnywDA7hrbGqbpOlfX0G8t3unVDrLAnns-cbf55kRzslOI5ZksyeUDsY2QnsklJLNMRKT740t361RZZpb-RURLF4kXqH3fnSE7Qg9EXq6G12s1GWIje0IPR2zPCkykhxJsgvfLAlzWYLHYVTCIxB2qJVwDviveCP0AGF1Hj8tDmYYhcVPlp1SphbeWMKeAuTiEoLCIEbCDu-YAe0zzvcIbEfYzoxoF8NmTzZHQos3vHF_G3GGpRlw_kboNgQg-R4gcKN7mMddDji_Hl9B6gs6L7uZou-lm--tu5WXzQ2uwmqpu_ih98vrl-eX88vTH-cvzy9PhBbV1I3WaFxNDlei9WhXg7ngx02WYdFPVgPn3iLymPNF3xr5pOXfE_KZirCdI7RYaBzeRfv96_l4pz9KrPEqHfLaaOftVPuH51pjr8I2XDjup1HhDPmxe79bEbSa589B3E_HrbTOrwh74rxDzy9CTWE3dlgb3RC2D7rlx4eptXNA1olqpNEaYUDtpdHYAKH0IDTczAStVAgCfpG-nyqQzk0IQjegpH4D6aFHi4Sd4FmD7zEcmB1rocGJGzgzoO-l7kDJN5yhrwi9uMyoo_FzTKHg-wcDqe9Z-SjV6Ed8b36or840lVE-lNa_hJ4w_Wdbp332Z0wojZqSNVu2FRGWabYtsiIv1izqyzRpq4xRltVNumm3TV7QiuVi3W62dcZYE8mSJpSlCUvSfL1OaIysrlKaVWmVJXWbF2Sd4CCk-lba0SJFmSfZNouUqFC50EGUrGpC98tceogtZ6dVNXVufg7p_EeHiLz0auk9n9w2R_jtm3T_k_Szhs43IdPEGE1WlT-otTxqXJuB0NMcMPxWozV_4ZzSp4WEI_S08PgvAAD__780jmY">