Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++] Potential bugprone-use-after-move in std::map #70696

Open
mordante opened this issue Oct 30, 2023 · 0 comments
Open

[libc++] Potential bugprone-use-after-move in std::map #70696

mordante opened this issue Oct 30, 2023 · 0 comments
Assignees
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@mordante
Copy link
Member

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."

@mordante mordante added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Oct 30, 2023
@mordante mordante self-assigned this Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

1 participant