Skip to content

Conversation

asmok-g
Copy link

@asmok-g asmok-g commented Sep 23, 2025

Addressing report: #151951 (comment)

@asmok-g asmok-g requested a review from a team as a code owner September 23, 2025 14:11
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Sep 23, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 23, 2025

@llvm/pr-subscribers-libcxx

Author: None (asmok-g)

Changes

Addressing report: #151951 (comment)


Full diff: https://github.com/llvm/llvm-project/pull/160305.diff

2 Files Affected:

  • (modified) libcxx/include/ext/hash_map (+2-14)
  • (modified) libcxx/include/ext/hash_set (+2-14)
diff --git a/libcxx/include/ext/hash_map b/libcxx/include/ext/hash_map
index 70c2fbeec2959..73ebe134c6645 100644
--- a/libcxx/include/ext/hash_map
+++ b/libcxx/include/ext/hash_map
@@ -472,7 +472,7 @@ public:
            const hasher& __hf,
            const key_equal& __eql,
            const allocator_type& __a);
-  _LIBCPP_HIDE_FROM_ABI hash_map(const hash_map& __u);
+  _LIBCPP_HIDE_FROM_ABI hash_map(const hash_map& __u) = default;
 
   _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
 
@@ -569,12 +569,6 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(
   insert(__first, __last);
 }
 
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_map(const hash_map& __u) : __table_(__u.__table_) {
-  __table_.__rehash_unique(__u.bucket_count());
-  insert(__u.begin(), __u.end());
-}
-
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
 typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
 hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k) {
@@ -696,7 +690,7 @@ public:
       const hasher& __hf,
       const key_equal& __eql,
       const allocator_type& __a);
-  _LIBCPP_HIDE_FROM_ABI hash_multimap(const hash_multimap& __u);
+  _LIBCPP_HIDE_FROM_ABI hash_multimap(const hash_multimap& __u) = default;
 
   _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
 
@@ -786,12 +780,6 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
   insert(__first, __last);
 }
 
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(const hash_multimap& __u) : __table_(__u.__table_) {
-  __table_.__rehash_multi(__u.bucket_count());
-  insert(__u.begin(), __u.end());
-}
-
 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
 template <class _InputIterator>
 inline void hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
diff --git a/libcxx/include/ext/hash_set b/libcxx/include/ext/hash_set
index 62a7a0dbcffb9..29e258ca382f8 100644
--- a/libcxx/include/ext/hash_set
+++ b/libcxx/include/ext/hash_set
@@ -265,7 +265,7 @@ public:
            const hasher& __hf,
            const key_equal& __eql,
            const allocator_type& __a);
-  _LIBCPP_HIDE_FROM_ABI hash_set(const hash_set& __u);
+  _LIBCPP_HIDE_FROM_ABI hash_set(const hash_set& __u) = default;
 
   _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
 
@@ -355,12 +355,6 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
   insert(__first, __last);
 }
 
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(const hash_set& __u) : __table_(__u.__table_) {
-  __table_.__rehash_unique(__u.bucket_count());
-  insert(__u.begin(), __u.end());
-}
-
 template <class _Value, class _Hash, class _Pred, class _Alloc>
 template <class _InputIterator>
 inline void hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {
@@ -445,7 +439,7 @@ public:
       const hasher& __hf,
       const key_equal& __eql,
       const allocator_type& __a);
-  _LIBCPP_HIDE_FROM_ABI hash_multiset(const hash_multiset& __u);
+  _LIBCPP_HIDE_FROM_ABI hash_multiset(const hash_multiset& __u) = default;
 
   _LIBCPP_HIDE_FROM_ABI allocator_type get_allocator() const { return allocator_type(__table_.__node_alloc()); }
 
@@ -533,12 +527,6 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
   insert(__first, __last);
 }
 
-template <class _Value, class _Hash, class _Pred, class _Alloc>
-hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(const hash_multiset& __u) : __table_(__u.__table_) {
-  __table_.__rehash_multi(__u.bucket_count());
-  insert(__u.begin(), __u.end());
-}
-
 template <class _Value, class _Hash, class _Pred, class _Alloc>
 template <class _InputIterator>
 inline void hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first, _InputIterator __last) {

@philnik777
Copy link
Contributor

Hey, sorry I didn't update. #160043 should fix the issue.

@ldionne
Copy link
Member

ldionne commented Sep 30, 2025

Closing since this was addressed in #160043

@ldionne ldionne closed this Sep 30, 2025
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

Successfully merging this pull request may close these issues.

4 participants