From f0d59405f0771a236c57e3c328b91c0d3df7a0c4 Mon Sep 17 00:00:00 2001 From: Marshall Clow Date: Mon, 17 Apr 2017 13:19:14 +0000 Subject: [PATCH] Mark LWG#2853 as complete. No code changes required, but added a couple of extra tests llvm-svn: 300449 --- .../vector/vector.modifiers/erase_iter.pass.cpp | 24 ++++++++++++++++++++++ .../vector.modifiers/erase_iter_iter.pass.cpp | 24 ++++++++++++++++++++++ libcxx/www/cxx1z_status.html | 4 ++-- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp index dbdccf1..f9d1171 100644 --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter.pass.cpp @@ -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 v(arr, arr+3); + Throws::sThrows = true; + v.erase(v.begin()); + v.erase(--v.end()); + v.erase(v.begin()); + assert(v.size() == 0); + } } diff --git a/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp index f7fa0db..48f61dd 100644 --- a/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp +++ b/libcxx/test/std/containers/sequences/vector/vector.modifiers/erase_iter_iter.pass.cpp @@ -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 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); + } } diff --git a/libcxx/www/cxx1z_status.html b/libcxx/www/cxx1z_status.html index 01ca3ee..ae2437e 100644 --- a/libcxx/www/cxx1z_status.html +++ b/libcxx/www/cxx1z_status.html @@ -462,7 +462,7 @@ 2838is_literal_type specification needs a little cleanupKonaComplete 2842in_place_t check for optional::optional(U&&) should decay UKonaComplete 2850std::function move constructor does unnecessary workKona - 2853Possible inconsistency in specification of erase in [vector.modifiers]Kona + 2853Possible inconsistency in specification of erase in [vector.modifiers]KonaComplete 2855std::throw_with_nested("string_literal")KonaComplete 2857{variant,optional,any}::emplace should return the constructed valueKonaComplete 2861basic_string should require that charT match traits::char_typeKonaComplete @@ -489,7 +489,7 @@ -

Last Updated: 13-Apr-2017

+

Last Updated: 17-Apr-2017

-- 2.7.4