[libcxx-commits] [PATCH] D61139: (ABI break) Remove could-be-defaulted SMFs from `stack` and `queue` and `priority_queue`.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 25 10:23:41 PDT 2019


Quuxplusone created this revision.
Quuxplusone added a reviewer: mclow.lists.
Quuxplusone added a project: libc++.
Herald added subscribers: libcxx-commits, ldionne.

This is an ABI break iff the defaulted SMF becomes trivial; for example, `std::stack<char, trivial_fixed_capacity_vector<char, 8>>` is trivially copyable after this change, which affects the calling convention when passing it by value.
Example: https://godbolt.org/z/Kjwe-5

Also, `std::stack<T, fixed_capacity_vector<T, N>>` is nothrow-copy-constructible after this change; that's not an ABI break but it is detectable.


Repository:
  rCXX libc++

https://reviews.llvm.org/D61139

Files:
  include/queue
  include/stack


Index: include/stack
===================================================================
--- include/stack
+++ include/stack
@@ -128,25 +128,8 @@
         _NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
         : c() {}
 
-    _LIBCPP_INLINE_VISIBILITY
-    stack(const stack& __q) : c(__q.c) {}
-
-    _LIBCPP_INLINE_VISIBILITY
-    stack& operator=(const stack& __q) {c = __q.c; return *this;}
-
-
 #ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
-    stack(stack&& __q)
-        _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
-        : c(_VSTD::move(__q.c)) {}
-
-    _LIBCPP_INLINE_VISIBILITY
-    stack& operator=(stack&& __q)
-        _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
-        {c = _VSTD::move(__q.c); return *this;}
-
-    _LIBCPP_INLINE_VISIBILITY
     explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {}
 #endif  // _LIBCPP_CXX03_LANG
 
Index: include/queue
===================================================================
--- include/queue
+++ include/queue
@@ -230,24 +230,6 @@
         : c() {}
 
     _LIBCPP_INLINE_VISIBILITY
-    queue(const queue& __q) : c(__q.c) {}
-
-    _LIBCPP_INLINE_VISIBILITY
-    queue& operator=(const queue& __q) {c = __q.c; return *this;}
-
-#ifndef _LIBCPP_CXX03_LANG
-    _LIBCPP_INLINE_VISIBILITY
-    queue(queue&& __q)
-        _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
-        : c(_VSTD::move(__q.c)) {}
-
-    _LIBCPP_INLINE_VISIBILITY
-    queue& operator=(queue&& __q)
-        _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
-        {c = _VSTD::move(__q.c); return *this;}
-#endif  // _LIBCPP_CXX03_LANG
-
-    _LIBCPP_INLINE_VISIBILITY
     explicit queue(const container_type& __c)  : c(__c) {}
 #ifndef _LIBCPP_CXX03_LANG
     _LIBCPP_INLINE_VISIBILITY
@@ -447,27 +429,6 @@
         : c(), comp() {}
 
     _LIBCPP_INLINE_VISIBILITY
-    priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
-
-    _LIBCPP_INLINE_VISIBILITY
-    priority_queue& operator=(const priority_queue& __q)
-        {c = __q.c; comp = __q.comp; return *this;}
-
-#ifndef _LIBCPP_CXX03_LANG
-    _LIBCPP_INLINE_VISIBILITY
-    priority_queue(priority_queue&& __q)
-        _NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
-                   is_nothrow_move_constructible<value_compare>::value)
-        : c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {}
-
-    _LIBCPP_INLINE_VISIBILITY
-    priority_queue& operator=(priority_queue&& __q)
-        _NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
-                   is_nothrow_move_assignable<value_compare>::value)
-        {c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
-#endif  // _LIBCPP_CXX03_LANG
-
-    _LIBCPP_INLINE_VISIBILITY
     explicit priority_queue(const value_compare& __comp)
         : c(), comp(__comp) {}
     _LIBCPP_INLINE_VISIBILITY


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61139.196668.patch
Type: text/x-patch
Size: 2952 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190425/07c03103/attachment.bin>


More information about the libcxx-commits mailing list