From 7977ad764446e9eef6f4780f0c5949b565ad4093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Ondru=C5=A1ek?= Date: Thu, 23 Mar 2023 16:39:32 -0700 Subject: [PATCH] fix on() tag_invoke overload - arguments in the concept were swapped - add a regression test --- include/unifex/on.hpp | 2 +- test/on_test.cpp | 81 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 test/on_test.cpp diff --git a/include/unifex/on.hpp b/include/unifex/on.hpp index fbad1216a..8a7415bb4 100644 --- a/include/unifex/on.hpp +++ b/include/unifex/on.hpp @@ -31,7 +31,7 @@ namespace _on { inline const struct _fn { template(typename Scheduler, typename Sender) (requires sender AND scheduler AND // - tag_invocable<_fn, Sender, Scheduler>) + tag_invocable<_fn, Scheduler, Sender>) auto operator()(Scheduler&& scheduler, Sender&& sender) const noexcept(is_nothrow_tag_invocable_v<_fn, Scheduler, Sender>) -> tag_invoke_result_t<_fn, Scheduler, Sender> { diff --git a/test/on_test.cpp b/test/on_test.cpp new file mode 100644 index 000000000..1364ffa5c --- /dev/null +++ b/test/on_test.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * Licensed under the Apache License Version 2.0 with LLVM Exceptions + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * https://llvm.org/LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include +#include +#include +#include +#include + +#include +#include + +using namespace unifex; + +namespace { +struct Customized { + std::thread::id id2 = std::this_thread::get_id(); + template < + template + class Variant, + template + class Tuple> + using value_types = Variant>; + + template