Skip to content

Commit d43b0e0

Browse files
committed
try to avoid a TSan multi-definition error
1 parent 6297d21 commit d43b0e0

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ bool fail{};
1414
}
1515

1616
// NOLINTNEXTLINE(hicpp-no-malloc)
17+
#if not defined(__clang__) || not defined(__SANITIZE_ADDRESS__)
1718
auto operator new(::std::size_t size) -> void* { return fail ? throw ::std::bad_alloc() : ::std::malloc(size); }
1819

1920
auto operator delete(void* ptr) noexcept -> void { ::std::free(ptr); } // NOLINT(hicpp-no-malloc)
2021
auto operator delete(void* ptr, ::std::size_t) noexcept -> void { ::std::free(ptr); } // NOLINT(hicpp-no-malloc)
22+
#endif
2123

2224
TEST(stopsource_cons) {
25+
#if not defined(__clang__) || not defined(__SANITIZE_ADDRESS__)
2326
// Reference: [stopsource.cons] p1
2427
try {
2528
::test_std::stop_source source;
@@ -40,4 +43,5 @@ TEST(stopsource_cons) {
4043
} catch (...) {
4144
ASSERT(nullptr == "can't be reached"); // NOLINT(cert-dcl03-c,hicpp-static-assert,misc-static-assert)
4245
}
46+
#endif
4347
}

0 commit comments

Comments
 (0)