mirror of
https://github.com/llvm-mirror/libcxx.git
synced 2025-10-23 18:38:30 +08:00
Fix incorrect exception handling behavior in the uninitialized algorithms
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@283941 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user