Skip to content

Commit

Permalink
Mark lambda as noexcept
Browse files Browse the repository at this point in the history
  • Loading branch information
j-stephan authored and bernhardmgruber committed Aug 31, 2023
1 parent 11c199a commit 6df4955
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/alpaka/core/ThreadPool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace alpaka::core::detail
template<typename TFnObj, typename... TArgs>
auto enqueueTask(TFnObj&& task, TArgs&&... args) -> std::future<void>
{
auto ptask = Task{[=, t = std::forward<TFnObj>(task)] { t(args...); }};
auto ptask = Task{[=, t = std::forward<TFnObj>(task)]() noexcept(noexcept(task(args...))) { t(args...); }};
auto future = ptask.get_future();
{
std::lock_guard<std::mutex> lock{m_mutex};
Expand Down
4 changes: 2 additions & 2 deletions test/unit/core/src/ThreadPool.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright 2023 Bernhard Manfred Gruber
/* Copyright 2023 Bernhard Manfred Gruber, Jan Stephan
* SPDX-License-Identifier: MPL-2.0
*/

Expand All @@ -18,7 +18,7 @@ TEST_CASE("threadpool", "[core]")

auto f1 = tp.enqueueTask([] { throw std::runtime_error("42"); });
auto f2 = tp.enqueueTask([] { throw 42; });
auto f3 = tp.enqueueTask([] {});
auto f3 = tp.enqueueTask([]() noexcept {});

CHECK_THROWS_AS(f1.get(), std::runtime_error);

Expand Down

0 comments on commit 6df4955

Please sign in to comment.