[libcxx] r300449 - Mark LWG#2853 as complete. No code changes required, but added a couple of extra tests

Marshall Clow via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 17 06:19:15 PDT 2017


Author: marshall
Date: Mon Apr 17 08:19:14 2017
New Revision: 300449

URL: http://llvm.org/viewvc/llvm-project?rev=300449&view=rev
Log:
Mark LWG#2853 as complete. No code changes required, but added a couple of extra tests

Modified:
    libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
    libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp
    libcxx/trunk/www/cxx1z_status.html

Modified: libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp?rev=300449&r1=300448&r2=300449&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp Mon Apr 17 08:19:14 2017
@@ -18,6 +18,19 @@
 #include "min_allocator.h"
 #include "asan_testing.h"
 
+struct Throws {
+    Throws() : v_(0) {}
+    Throws(int v) : v_(v) {}
+    Throws(const Throws  &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+    Throws(      Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+    Throws& operator=(const Throws  &rhs) { v_ = rhs.v_; return *this; }
+    Throws& operator=(      Throws &&rhs) { v_ = rhs.v_; return *this; }
+    int v_;
+    static bool sThrows;
+    };
+
+bool Throws::sThrows = false;
+
 int main()
 {
     {
@@ -72,4 +85,15 @@ int main()
     assert(is_contiguous_container_asan_correct(l1));
     }
 #endif
+// Test for LWG2853:
+// Throws: Nothing unless an exception is thrown by the assignment operator or move assignment operator of T.
+    {
+    Throws arr[] = {1, 2, 3};
+    std::vector<Throws> v(arr, arr+3);
+    Throws::sThrows = true;
+    v.erase(v.begin());
+    v.erase(--v.end());
+    v.erase(v.begin());
+    assert(v.size() == 0);
+    }
 }

Modified: libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp?rev=300449&r1=300448&r2=300449&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp Mon Apr 17 08:19:14 2017
@@ -18,6 +18,19 @@
 #include "min_allocator.h"
 #include "asan_testing.h"
 
+struct Throws {
+    Throws() : v_(0) {}
+    Throws(int v) : v_(v) {}
+    Throws(const Throws  &rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+    Throws(      Throws &&rhs) : v_(rhs.v_) { if (sThrows) throw 1; }
+    Throws& operator=(const Throws  &rhs) { v_ = rhs.v_; return *this; }
+    Throws& operator=(      Throws &&rhs) { v_ = rhs.v_; return *this; }
+    int v_;
+    static bool sThrows;
+    };
+
+bool Throws::sThrows = false;
+
 int main()
 {
     int a1[] = {1, 2, 3};
@@ -125,4 +138,15 @@ int main()
         assert(is_contiguous_container_asan_correct(outer[1]));
     }
 #endif
+// Test for LWG2853:
+// Throws: Nothing unless an exception is thrown by the assignment operator or move assignment operator of T.
+    {
+    Throws arr[] = {1, 2, 3};
+    std::vector<Throws> v(arr, arr+3);
+    Throws::sThrows = true;
+    v.erase(v.begin(), --v.end());
+    assert(v.size() == 1);
+    v.erase(v.begin(), v.end());
+    assert(v.size() == 0);
+    }
 }

Modified: libcxx/trunk/www/cxx1z_status.html
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=300449&r1=300448&r2=300449&view=diff
==============================================================================
--- libcxx/trunk/www/cxx1z_status.html (original)
+++ libcxx/trunk/www/cxx1z_status.html Mon Apr 17 08:19:14 2017
@@ -462,7 +462,7 @@
 	<tr><td><a href="http://wg21.link/LWG2838">2838</a></td><td>is_literal_type specification needs a little cleanup</td><td>Kona</td><td>Complete</td></tr>
 	<tr><td><a href="http://wg21.link/LWG2842">2842</a></td><td>in_place_t check for optional::optional(U&&) should decay U</td><td>Kona</td><td>Complete</td></tr>
 	<tr><td><a href="http://wg21.link/LWG2850">2850</a></td><td>std::function move constructor does unnecessary work</td><td>Kona</td><td></td></tr>
-	<tr><td><a href="http://wg21.link/LWG2853">2853</a></td><td>Possible inconsistency in specification of erase in [vector.modifiers]</td><td>Kona</td><td></td></tr>
+	<tr><td><a href="http://wg21.link/LWG2853">2853</a></td><td>Possible inconsistency in specification of erase in [vector.modifiers]</td><td>Kona</td><td>Complete</td></tr>
 	<tr><td><a href="http://wg21.link/LWG2855">2855</a></td><td>std::throw_with_nested("string_literal")</td><td>Kona</td><td>Complete</td></tr>
 	<tr><td><a href="http://wg21.link/LWG2857">2857</a></td><td>{variant,optional,any}::emplace should return the constructed value</td><td>Kona</td><td>Complete</td></tr>
 	<tr><td><a href="http://wg21.link/LWG2861">2861</a></td><td>basic_string should require that charT match traits::char_type</td><td>Kona</td><td>Complete</td></tr>
@@ -489,7 +489,7 @@
 <!-- 	<tr><td></td><td></td><td></td><td></td></tr> -->
   </table>
 
-  <p>Last Updated: 13-Apr-2017</p>
+  <p>Last Updated: 17-Apr-2017</p>
 </div>
 </body>
 </html>




More information about the cfe-commits mailing list