[libcxx-commits] [PATCH] D71744: [libc++] avoid g++9 Wdeprecated-copy in __hash_table & __tree

Ryan Libby via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 20 01:43:17 PST 2019

rlibby created this revision.
rlibby added reviewers: erik.pilkington, howard.hinnant, EricWF.
Herald added subscribers: libcxx-commits, dexonsmith, ldionne, christof, krytarowski, arichardson, emaste.

g++9 now warns if a copy assignment operator is specified and a default
copy constructor is implicitly generated, or vice versa.  libc++ tripped
these warnings with some copy assignment operators which were declared
private and not defined.  Avoid the warnings by declaring them with

I should say that I am putting this patch up for comment without having
done all due diligence.  I am not an expert here in any case, I don't
have a strong grasp of what's going on here and whether this patch is in
the right direction.

This assumes that the intention of these declarations really had been to
prevent use of the operator=, and that the existing uses of the
implicitly generated default copy constructors are intended and okay.

I have also not yet done useful testing with libcxx.  I have however
checked that after applying this patch to the libcxx imported into
FreeBSD, that I no longer see the Wdeprecated-copy warnings upon
building C++ programs with g++9.

  rCXX libc++



Index: include/__tree
--- include/__tree
+++ include/__tree
@@ -775,7 +775,8 @@
     typedef __tree_node_types<pointer> _NodeTypes;
     allocator_type& __na_;
-    __tree_node_destructor& operator=(const __tree_node_destructor&);
+    __tree_node_destructor& operator=(const __tree_node_destructor&)
     bool __value_constructed;
Index: include/__hash_table
--- include/__hash_table
+++ include/__hash_table
@@ -825,7 +825,8 @@
     allocator_type& __na_;
-    __hash_node_destructor& operator=(const __hash_node_destructor&);
+    __hash_node_destructor& operator=(const __hash_node_destructor&)
     bool __value_constructed;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71744.234837.patch
Type: text/x-patch
Size: 842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191220/b69186ec/attachment.bin>

More information about the libcxx-commits mailing list