diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-10-11 21:13:44 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-10-11 21:13:44 +0000 |
commit | e778d10c0fc39d4e52dcd54dc9c97d20b0310404 (patch) | |
tree | dbdd13ed383057f5fa9c49e54e3a06b6a54165c0 /libcxx/test | |
parent | 7d84aff200a3d72108e0e0011116dbcffce9a6e2 (diff) | |
download | bcm5719-llvm-e778d10c0fc39d4e52dcd54dc9c97d20b0310404.tar.gz bcm5719-llvm-e778d10c0fc39d4e52dcd54dc9c97d20b0310404.zip |
Fix incorrect exception handling behavior in the uninitialized algorithms
llvm-svn: 283941
Diffstat (limited to 'libcxx/test')
5 files changed, 14 insertions, 24 deletions
diff --git a/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp b/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp index cd57769df2e..533d516707e 100644 --- a/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp +++ b/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct.pass.cpp @@ -47,7 +47,7 @@ struct ThrowsCounted { ++count; } ThrowsCounted(ThrowsCounted const&) { assert(false); } - ~ThrowsCounted() { --count; } + ~ThrowsCounted() { assert(count > 0); --count; } friend void operator&(ThrowsCounted) = delete; }; int ThrowsCounted::count = 0; @@ -67,10 +67,8 @@ void test_ctor_throws() std::uninitialized_default_construct(It(p), It(p+N)); assert(false); } catch (...) {} - assert(ThrowsCounted::count == 3); - assert(ThrowsCounted::constructed == 4); // forth construction throws - std::destroy(p, p+3); assert(ThrowsCounted::count == 0); + assert(ThrowsCounted::constructed == 4); // forth construction throws #endif } diff --git a/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp b/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp index bfb74b99ecd..f22a74f1f83 100644 --- a/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp +++ b/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.default/uninitialized_default_construct_n.pass.cpp @@ -27,7 +27,7 @@ struct Counted { static void reset() { count = constructed = 0; } explicit Counted() { ++count; ++constructed; } Counted(Counted const&) { assert(false); } - ~Counted() { --count; } + ~Counted() { assert(count > 0); --count; } friend void operator&(Counted) = delete; }; int Counted::count = 0; @@ -47,7 +47,7 @@ struct ThrowsCounted { ++count; } ThrowsCounted(ThrowsCounted const&) { assert(false); } - ~ThrowsCounted() { --count; } + ~ThrowsCounted() { assert(count > 0); --count; } friend void operator&(ThrowsCounted) = delete; }; int ThrowsCounted::count = 0; @@ -66,10 +66,8 @@ void test_ctor_throws() std::uninitialized_default_construct_n(It(p), N); assert(false); } catch (...) {} - assert(ThrowsCounted::count == 3); - assert(ThrowsCounted::constructed == 4); // forth construction throws - std::destroy(p, p+3); assert(ThrowsCounted::count == 0); + assert(ThrowsCounted::constructed == 4); // forth construction throws #endif } diff --git a/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp b/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp index befe30a6c03..c2d860694a7 100644 --- a/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp +++ b/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.construct.value/uninitialized_value_construct.pass.cpp @@ -27,7 +27,7 @@ struct Counted { static void reset() { count = constructed = 0; } explicit Counted() { ++count; ++constructed; } Counted(Counted const&) { assert(false); } - ~Counted() { --count; } + ~Counted() { assert(count > 0); --count; } friend void operator&(Counted) = delete; }; int Counted::count = 0; @@ -47,7 +47,7 @@ struct ThrowsCounted { ++count; } ThrowsCounted(ThrowsCounted const&) { assert(false); } - ~ThrowsCounted() { --count; } + ~ThrowsCounted() { assert(count > 0); --count; } friend void operator&(ThrowsCounted) = delete; }; int ThrowsCounted::count = 0; @@ -66,10 +66,8 @@ void test_ctor_throws() std::uninitialized_value_construct(It(p), It(p+N)); assert(false); } catch (...) {} - assert(ThrowsCounted::count == 3); - assert(ThrowsCounted::constructed == 4); // forth construction throws - std::destroy(p, p+3); assert(ThrowsCounted::count == 0); + assert(ThrowsCounted::constructed == 4); // forth construction throws #endif } diff --git a/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp b/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp index 6149838218e..d7a9542b4c2 100644 --- a/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp +++ b/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move.pass.cpp @@ -27,7 +27,7 @@ struct Counted { static void reset() { count = constructed = 0; } explicit Counted(int&& x) : value(x) { x = 0; ++count; ++constructed; } Counted(Counted const&) { assert(false); } - ~Counted() { --count; } + ~Counted() { assert(count > 0); --count; } friend void operator&(Counted) = delete; int value; }; @@ -48,7 +48,7 @@ struct ThrowsCounted { x = 0; } ThrowsCounted(ThrowsCounted const&) { assert(false); } - ~ThrowsCounted() { --count; } + ~ThrowsCounted() { assert(count > 0); --count; } friend void operator&(ThrowsCounted) = delete; }; int ThrowsCounted::count = 0; @@ -68,15 +68,13 @@ void test_ctor_throws() std::uninitialized_move(values, values + N, It(p)); assert(false); } catch (...) {} - assert(ThrowsCounted::count == 3); + assert(ThrowsCounted::count == 0); assert(ThrowsCounted::constructed == 4); // forth construction throws assert(values[0] == 0); assert(values[1] == 0); assert(values[2] == 0); assert(values[3] == 4); assert(values[4] == 5); - std::destroy(p, p+3); - assert(ThrowsCounted::count == 0); #endif } diff --git a/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp b/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp index cf6af7472b8..f27e5726135 100644 --- a/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp +++ b/libcxx/test/std/utilities/memory/specialized.algorithms/uninitialized.move/uninitialized_move_n.pass.cpp @@ -27,7 +27,7 @@ struct Counted { static void reset() { count = constructed = 0; } explicit Counted(int&& x) : value(x) { x = 0; ++count; ++constructed; } Counted(Counted const&) { assert(false); } - ~Counted() { --count; } + ~Counted() { assert(count > 0); --count; } friend void operator&(Counted) = delete; int value; }; @@ -48,7 +48,7 @@ struct ThrowsCounted { x = 0; } ThrowsCounted(ThrowsCounted const&) { assert(false); } - ~ThrowsCounted() { --count; } + ~ThrowsCounted() { assert(count > 0); --count; } friend void operator&(ThrowsCounted) = delete; }; int ThrowsCounted::count = 0; @@ -68,15 +68,13 @@ void test_ctor_throws() std::uninitialized_move_n(values, N, It(p)); assert(false); } catch (...) {} - assert(ThrowsCounted::count == 3); + assert(ThrowsCounted::count == 0); assert(ThrowsCounted::constructed == 4); // forth construction throws assert(values[0] == 0); assert(values[1] == 0); assert(values[2] == 0); assert(values[3] == 4); assert(values[4] == 5); - std::destroy(p, p+3); - assert(ThrowsCounted::count == 0); #endif } |