Mark LWG#2853 as complete. No code changes required, but added a couple of extra...
authorMarshall Clow <mclow.lists@gmail.com>
Mon, 17 Apr 2017 13:19:14 +0000 (13:19 +0000)
committerMarshall Clow <mclow.lists@gmail.com>
Mon, 17 Apr 2017 13:19:14 +0000 (13:19 +0000)
llvm-svn: 300449

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

index dbdccf1..f9d1171 100644 (file)
 #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);
+    }
 }
index f7fa0db..48f61dd 100644 (file)
 #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);
+    }
 }
index 01ca3ee..ae2437e 100644 (file)
        <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&amp;&amp;) 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>
 <!--   <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>