[libcxx-commits] [libcxx] [libc++][test] Improve ThrowingT to Accurately Throw after throw_after > 1 Use (PR #114077)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Oct 29 09:25:46 PDT 2024
https://github.com/winner245 updated https://github.com/llvm/llvm-project/pull/114077
>From 7886925138d83f7f594786c1ddbbb9242f5bb71e Mon Sep 17 00:00:00 2001
From: Peng Liu <winner245 at hotmail.com>
Date: Tue, 29 Oct 2024 11:22:41 -0400
Subject: [PATCH 1/2] Improve ThrowingT to accurately control when to throw
---
.../sequences/vector/vector.cons/exceptions.pass.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp
index c9c1bac2fb4a0c..bd9ea9e1b660ce 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp
@@ -49,13 +49,14 @@ struct ThrowingT {
--throw_after_n;
}
- ThrowingT(const ThrowingT&) {
+ ThrowingT(const ThrowingT& rhs) : throw_after_n_{rhs.throw_after_n_} {
if (throw_after_n_ == nullptr || *throw_after_n_ == 0)
throw 1;
--*throw_after_n_;
}
- ThrowingT& operator=(const ThrowingT&) {
+ ThrowingT& operator=(const ThrowingT& rhs) {
+ throw_after_n_ = rhs.throw_after_n_;
if (throw_after_n_ == nullptr || *throw_after_n_ == 0)
throw 1;
--*throw_after_n_;
>From 08e677d42d38bfbaf51b53bccdea0788360baaea Mon Sep 17 00:00:00 2001
From: Peng Liu <winner245 at hotmail.com>
Date: Tue, 29 Oct 2024 12:23:12 -0400
Subject: [PATCH 2/2] Replace {} with () to support cxx03 tests
---
.../containers/sequences/vector/vector.cons/exceptions.pass.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp b/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp
index bd9ea9e1b660ce..e2b0d691889c6c 100644
--- a/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp
+++ b/libcxx/test/std/containers/sequences/vector/vector.cons/exceptions.pass.cpp
@@ -49,7 +49,7 @@ struct ThrowingT {
--throw_after_n;
}
- ThrowingT(const ThrowingT& rhs) : throw_after_n_{rhs.throw_after_n_} {
+ ThrowingT(const ThrowingT& rhs) : throw_after_n_(rhs.throw_after_n_) {
if (throw_after_n_ == nullptr || *throw_after_n_ == 0)
throw 1;
--*throw_after_n_;
More information about the libcxx-commits
mailing list