diff --git a/libs/core/executors/include/hpx/executors/explicit_scheduler_executor.hpp b/libs/core/executors/include/hpx/executors/explicit_scheduler_executor.hpp index 3f1b4b6f81c..62102e554f5 100644 --- a/libs/core/executors/include/hpx/executors/explicit_scheduler_executor.hpp +++ b/libs/core/executors/include/hpx/executors/explicit_scheduler_executor.hpp @@ -192,7 +192,14 @@ namespace hpx::execution::experimental { typename hpx::traits::range_traits::value_type; using result_type = hpx::util::detail::invoke_deferred_result_t; - + + /* A boolean as result_type is disallowed because the elements of a + * vector cannot be modified concurrently. */ + static_assert(!std::is_same_v, + "Using an invocable that returns a boolean with " + "explicit_scheduler_executor::bulk_async_execution " + "can result in data races!"); + #ifdef HPX_HAVE_STDEXEC // We are using HPX's bulk implementation for now, so this works for // other types too.