Skip to content

Commit 1fa6792

Browse files
committed
Improve ThrowingT to accurately control when to throw
1 parent 80a0973 commit 1fa6792

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ struct ThrowingT {
4949
--throw_after_n;
5050
}
5151

52-
ThrowingT(const ThrowingT&) {
52+
ThrowingT(const ThrowingT& rhs) : throw_after_n_{rhs.throw_after_n_} {
5353
if (throw_after_n_ == nullptr || *throw_after_n_ == 0)
5454
throw 1;
5555
--*throw_after_n_;
5656
}
5757

58-
ThrowingT& operator=(const ThrowingT&) {
58+
ThrowingT& operator=(const ThrowingT& rhs) {
59+
throw_after_n_ = rhs.throw_after_n_;
5960
if (throw_after_n_ == nullptr || *throw_after_n_ == 0)
6061
throw 1;
6162
--*throw_after_n_;

0 commit comments

Comments
 (0)