Skip to content

Commit e6f7222

Browse files
committed
fixed an issue detected by MSVC++
1 parent 68eaa37 commit e6f7222

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

tests/beman/execution26/exec-let.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ TEST(exec_let) {
117117
try {
118118
test_let_value();
119119
test_let_value_allocator();
120-
} catch (const std::exception& e) {
120+
} catch (...) {
121121
// NOLINTBEGIN(cert-dcl03-c,hicpp-static-assert,misc-static-assert)
122122
ASSERT(nullptr == "let tests are not expected to throw");
123123
// NOLINTEND(cert-dcl03-c,hicpp-static-assert,misc-static-assert)

tests/beman/execution26/exec-snd-expos.test.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,8 @@ auto test_connect_all() -> void {
935935
static_assert(requires { s.connect(receiver{}); });
936936
static_assert(requires { test_std::connect(s, receiver{}); });
937937
test_detail::basic_state state{std::move(s), receiver{}};
938-
auto product{test_detail::connect_all(&state, std::move(s), std::index_sequence<0, 1, 2, 3>{})};
938+
const sender4 s1{};
939+
auto product{test_detail::connect_all(&state, std::move(s1), std::index_sequence<0, 1, 2, 3>{})};
939940
ASSERT(product.size() == 4);
940941
test::use(product);
941942
}

tests/beman/execution26/stopsource-cons.test.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,36 @@
88
#include <cstddef>
99
#include <cstring>
1010

11+
namespace {
1112
bool fail{};
1213

14+
}
15+
16+
// NOLINTNEXTLINE(hicpp-no-malloc)
1317
auto operator new(::std::size_t size) -> void* { return fail ? throw ::std::bad_alloc() : ::std::malloc(size); }
1418

15-
auto operator delete(void* ptr) noexcept -> void { ::std::free(ptr); }
16-
auto operator delete(void* ptr, ::std::size_t) noexcept -> void { ::std::free(ptr); }
19+
auto operator delete(void* ptr) noexcept -> void { ::std::free(ptr); } // NOLINT(hicpp-no-malloc)
20+
auto operator delete(void* ptr, ::std::size_t) noexcept -> void { ::std::free(ptr); } // NOLINT(hicpp-no-malloc)
1721

1822
TEST(stopsource_cons) {
1923
// Reference: [stopsource.cons] p1
2024
::test_std::stop_source source;
21-
ASSERT(source.stop_possible());
22-
ASSERT((not source.stop_requested()));
25+
try {
26+
ASSERT(source.stop_possible());
27+
ASSERT((not source.stop_requested()));
28+
} catch (...) {
29+
ASSERT(nullptr == "can't be reached"); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert)
30+
}
2331

2432
// Reference: [stopsource.cons] p3
2533
fail = true;
2634
try {
27-
::test_std::stop_source();
28-
ASSERT(nullptr == "can't be reached");
35+
::test_std::stop_source source{};
36+
test::use(source);
37+
ASSERT(nullptr == "can't be reached"); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert)
2938
} catch (const ::std::bad_alloc&) {
30-
ASSERT(nullptr != "bad_alloc was thrown");
39+
ASSERT(nullptr != "bad_alloc was thrown"); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert)
40+
} catch (...) {
41+
ASSERT(nullptr == "can't be reached"); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert)
3142
}
3243
}

0 commit comments

Comments
 (0)