[libcxx] r342057 - Implement LWG #3017. list splice functions should use addressof

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 12 07:46:17 PDT 2018


Author: marshall
Date: Wed Sep 12 07:46:17 2018
New Revision: 342057

URL: http://llvm.org/viewvc/llvm-project?rev=342057&view=rev
Log:
Implement LWG #3017. list splice functions should use addressof

Modified:
    libcxx/trunk/include/list
    libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp
    libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
    libcxx/trunk/www/cxx2a_status.html

Modified: libcxx/trunk/include/list
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/list?rev=342057&r1=342056&r2=342057&view=diff
==============================================================================
--- libcxx/trunk/include/list (original)
+++ libcxx/trunk/include/list Wed Sep 12 07:46:17 2018
@@ -2208,7 +2208,7 @@ template <class _Comp>
 void
 list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
 {
-    if (this != &__c)
+    if (this != _VSTD::addressof(__c))
     {
         iterator __f1 = begin();
         iterator __e1 = end();

Modified: libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp?rev=342057&r1=342056&r2=342057&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/list/list.ops/merge.pass.cpp Wed Sep 12 07:46:17 2018
@@ -10,6 +10,7 @@
 // <list>
 
 // void merge(list& x);
+// If (&addressof(x) == this) does nothing; otherwise ...
 
 #include <list>
 #include <cassert>
@@ -26,7 +27,16 @@ int main()
     std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
     c1.merge(c2);
     assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
+    assert(c2.empty());
     }
+
+    {
+    int a1[] = {1, 3, 7, 9, 10};
+    std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    c1.merge(c1);
+    assert((c1 == std::list<int>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
+    }
+
 #if TEST_STD_VER >= 11
     {
     int a1[] = {1, 3, 7, 9, 10};
@@ -36,6 +46,7 @@ int main()
     std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
     c1.merge(c2);
     assert((c1 == std::list<int, min_allocator<int>>(a3, a3+sizeof(a3)/sizeof(a3[0]))));
+    assert(c2.empty());
     }
 #endif
 }

Modified: libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp?rev=342057&r1=342056&r2=342057&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/list/list.ops/merge_comp.pass.cpp Wed Sep 12 07:46:17 2018
@@ -10,6 +10,7 @@
 // <list>
 
 // template <class Compare> void merge(list& x, Compare comp);
+// If (&addressof(x) == this) does nothing; otherwise ...
 
 #include <list>
 #include <functional>
@@ -27,7 +28,15 @@ int main()
     std::list<int> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
     c1.merge(c2, std::greater<int>());
     assert(c1 == std::list<int>(a3, a3+sizeof(a3)/sizeof(a3[0])));
+    assert(c2.empty());
     }
+    {
+    int a1[] = {10, 9, 7, 3, 1};
+    std::list<int> c1(a1, a1+sizeof(a1)/sizeof(a1[0]));
+    c1.merge(c1, std::greater<int>());
+    assert((c1 == std::list<int>(a1, a1+sizeof(a1)/sizeof(a1[0]))));
+    }
+
 #if TEST_STD_VER >= 11
     {
     int a1[] = {10, 9, 7, 3, 1};
@@ -37,6 +46,7 @@ int main()
     std::list<int, min_allocator<int>> c2(a2, a2+sizeof(a2)/sizeof(a2[0]));
     c1.merge(c2, std::greater<int>());
     assert((c1 == std::list<int, min_allocator<int>>(a3, a3+sizeof(a3)/sizeof(a3[0]))));
+    assert(c2.empty());
     }
 #endif
 }

Modified: libcxx/trunk/www/cxx2a_status.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx2a_status.html?rev=342057&r1=342056&r2=342057&view=diff
==============================================================================
--- libcxx/trunk/www/cxx2a_status.html (original)
+++ libcxx/trunk/www/cxx2a_status.html Wed Sep 12 07:46:17 2018
@@ -73,7 +73,7 @@
 	<tr><td><a href="https://wg21.link/P0768R1">P0768R1</a></td><td>CWG</td><td>Library Support for the Spaceship (Comparison) Operator</td><td>Albuquerque</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0777R1">P0777R1</a></td><td>LWG</td><td>Treating Unnecessary <tt>decay</tt></td><td>Albuquerque</td><td>Complete</td><td>7.0</td></tr>
 	<tr><td><a href="https://wg21.link/P0122R7">P0122R7</a></td><td>LWG</td><td><span></td><td>Jacksonville</td><td>Complete</td><td>7.0</td></tr>
-	<tr><td><a href="https://wg21.link/P0355R7">P0355R7</a></td><td>LWG</td><td>Extending chrono to Calendars and Time Zones</td><td>Jacksonville</td><td></td><td></td></tr>
+	<tr><td><a href="https://wg21.link/P0355R7">P0355R7</a></td><td>LWG</td><td>Extending chrono to Calendars and Time Zones</td><td>Jacksonville</td><td></td><td><i>In progress</i></td></tr>
 	<tr><td><a href="https://wg21.link/P0551R3">P0551R3</a></td><td>LWG</td><td>Thou Shalt Not Specialize <tt>std</tt> Function Templates!</td><td>Jacksonville</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0753R2">P0753R2</a></td><td>LWG</td><td>Manipulators for C++ Synchronized Buffered Ostream</td><td>Jacksonville</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0754R2">P0754R2</a></td><td>LWG</td><td><version></td><td>Jacksonville</td><td>Complete</td><td>7.0</td></tr>
@@ -89,7 +89,7 @@
 	<tr><td><a href="https://wg21.link/P0476R2">P0476R2</a></td><td>LWG</td><td>Bit-casting object representations</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0528R3">P0528R3</a></td><td>CWG</td><td>The Curious Case of Padding Bits, Featuring Atomic Compare-and-Exchange</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0542R5">P0542R5</a></td><td>CWG</td><td>Support for contract based programming in C++</td><td>Rapperswil</td><td></td><td></td></tr>
-	<tr><td><a href="https://wg21.link/P0556R3">P0556R3</a></td><td>LWG</td><td>Integral power-of-2 operations</td><td>Rapperswil</td><td><i>In Progress</i></td><td></td></tr>
+	<tr><td><a href="https://wg21.link/P0556R3">P0556R3</a></td><td>LWG</td><td>Integral power-of-2 operations</td><td>Rapperswil</td><td><i>In Progress</i></td><td><i>In progress</i></td></tr>
 	<tr><td><a href="https://wg21.link/P0619R4">P0619R4</a></td><td>LWG</td><td>Reviewing Deprecated Facilities of C++17 for C++20</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0646R1">P0646R1</a></td><td>LWG</td><td>Improving the Return Value of Erase-Like Algorithms</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0722R3">P0722R3</a></td><td>CWG</td><td>Efficient sized delete for variable sized classes</td><td>Rapperswil</td><td></td><td></td></tr>
@@ -102,7 +102,7 @@
 	<tr><td><a href="https://wg21.link/P0892R2">P0892R2</a></td><td>CWG</td><td>explicit(bool)</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0898R3">P0898R3</a></td><td>LWG</td><td>Standard Library Concepts</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P0935R0">P0935R0</a></td><td>LWG</td><td>Eradicating unnecessarily explicit default constructors from the standard library</td><td>Rapperswil</td><td></td><td></td></tr>
-	<tr><td><a href="https://wg21.link/P0941R2">P0941R2</a></td><td>CWG</td><td>Integrating feature-test macros into the C++ WD</td><td>Rapperswil</td><td></td><td></td></tr>
+	<tr><td><a href="https://wg21.link/P0941R2">P0941R2</a></td><td>CWG</td><td>Integrating feature-test macros into the C++ WD</td><td>Rapperswil</td><td></td><td><i>In progress</i></td></tr>
 	<tr><td><a href="https://wg21.link/P1023R0">P1023R0</a></td><td>LWG</td><td>constexpr comparison operators for std::array</td><td>Rapperswil</td><td>Complete</td><td>8.0</td></tr>
 	<tr><td><a href="https://wg21.link/P1025R1">P1025R1</a></td><td>CWG</td><td>Update The Reference To The Unicode Standard</td><td>Rapperswil</td><td></td><td></td></tr>
 	<tr><td><a href="https://wg21.link/P1120R0">P1120R0</a></td><td>CWG</td><td>Consistency improvements for <=> and other comparison operators</td><td>Rapperswil</td><td></td><td></td></tr>
@@ -187,7 +187,7 @@
 	<tr><td><a href="https://wg21.link/LWG3013">3013</a></td><td><tt>(recursive_)directory_iterator</tt> construction and traversal should not be <tt>noexcept</tt></td><td>Jacksonville</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG3014">3014</a></td><td>More <tt>noexcept</tt> issues with filesystem operations</td><td>Jacksonville</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG3015">3015</a></td><td><tt>copy_options::<i>unspecified</i></tt> underspecified</td><td>Jacksonville</td><td><i>Nothing to do</i></td></tr>
-	<tr><td><a href="https://wg21.link/LWG3017">3017</a></td><td><tt>list splice</tt> functions should use <tt>addressof</tt></td><td>Jacksonville</td><td></td></tr>
+	<tr><td><a href="https://wg21.link/LWG3017">3017</a></td><td><tt>list splice</tt> functions should use <tt>addressof</tt></td><td>Jacksonville</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG3020">3020</a></td><td>[networking.ts] Remove spurious nested <tt>value_type</tt> buffer sequence requirement</td><td>Jacksonville</td><td></td></tr>
 	<tr><td><a href="https://wg21.link/LWG3026">3026</a></td><td><tt>filesystem::weakly_canonical</tt> still defined in terms of <tt>canonical(p, base)</tt></td><td>Jacksonville</td><td>Complete</td></tr>
 	<tr><td><a href="https://wg21.link/LWG3030">3030</a></td><td>Who shall meet the requirements of <tt>try_lock</tt>?</td><td>Jacksonville</td><td><i>Nothing to do</i></td></tr>
@@ -222,7 +222,7 @@
 <!-- 	<tr><td></td><td></td><td></td><td></td></tr> -->
   </table>
 
-  <p>Last Updated: 27-Aug-2018</p>
+  <p>Last Updated: 11-Sep-2018</p>
 </div>
 </body>
 </html>




More information about the cfe-commits mailing list