Skip to content

Commit 787327e

Browse files
Fix noexcept specification in qsbr_thread::make_qsbr_thread
Add some missing noexcept specifiers.
1 parent d1b7861 commit 787327e

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

qsbr.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,9 +1591,13 @@ class [[nodiscard]] qsbr_thread : public std::thread {
15911591
auto new_qsbr_per_thread = std::make_unique<qsbr_per_thread>();
15921592
return std::thread{
15931593
[inner_new_qsbr_per_thread = std::move(new_qsbr_per_thread)](
1594-
auto &&f2, auto &&...args2) mutable noexcept(noexcept(f2)) {
1594+
auto &&f2,
1595+
auto
1596+
&&...a2) mutable noexcept(noexcept(f2(std::
1597+
forward<decltype(a2)>(
1598+
a2)...))) {
15951599
qsbr_per_thread::set_instance(std::move(inner_new_qsbr_per_thread));
1596-
f2(std::forward<Args>(args2)...);
1600+
f2(std::forward<decltype(a2)>(a2)...);
15971601
},
15981602
std::forward<Function>(f), std::forward<Args>(args)...};
15991603
}

test/qsbr_gtest_utils.hpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ class QSBRTestBase : public ::testing::Test {
5656
[]() noexcept { return unodb::this_thread().is_qsbr_paused(); });
5757
}
5858

59-
static void qsbr_pause() {
59+
static void qsbr_pause()
60+
#ifndef UNODB_DETAIL_WITH_STATS
61+
noexcept
62+
#endif
63+
{
6064
unodb::test::must_not_allocate([]()
6165
#ifndef UNODB_DETAIL_WITH_STATS
6266
noexcept

test/test_qsbr.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ UNODB_TEST_F(QSBR, TwoThreads) {
5858
}
5959

6060
UNODB_TEST_F(QSBR, TwoThreadsSecondQuitPaused) {
61-
unodb::qsbr_thread second_thread([] { qsbr_pause(); });
61+
unodb::qsbr_thread second_thread([]()
62+
#ifndef UNODB_DETAIL_WITH_STATS
63+
noexcept
64+
#endif
65+
{ qsbr_pause(); });
6266
join(second_thread);
6367
}
6468

0 commit comments

Comments
 (0)