Skip to content

Commit 7140868

Browse files
authored
Fix main llvm 22 (#229)
* Fix Clang C++20 modules AST serialization bug with lambdas Clang fails to deserialize the unevaluated generic lambda used in the `has_completions` concept when building as a C++20 module. Extracted the lambda into a namespace-scope `constexpr` variable template to bypass the AST serialization crash. Extracting it to a constexpr variable caused another set of bugs with MSVC. therefore, lambda completely replaced with SFINAE style 'struct has_completions_impl' * Relax template template parameter matching for Clang 22 Clang 22 rejects passing the constrained template `wrap` to an unconstrained template template parameter (related to LLVM #182671). Relaxed `wrap` and `bad` to use `template <typename S>` in `exec-scope-concepts.test.cpp` to resolve the constraint violation.
1 parent 9f5d1d7 commit 7140868

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

include/beman/execution/detail/has_completions.hpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
#define INCLUDED_BEMAN_EXECUTION_DETAIL_HAS_COMPLETIONS
66

77
#include <beman/execution/detail/common.hpp>
8+
9+
#ifdef BEMAN_HAS_IMPORT_STD
10+
import std;
11+
#else
12+
#include <type_traits>
13+
#endif
814
#ifdef BEMAN_HAS_MODULES
915
import beman.execution.detail.completion_signatures;
1016
import beman.execution.detail.valid_completion_for;
@@ -16,11 +22,16 @@ import beman.execution.detail.valid_completion_for;
1622
// ----------------------------------------------------------------------------
1723

1824
namespace beman::execution::detail {
25+
1926
template <typename Receiver, typename Completions>
20-
concept has_completions = requires(Completions* completions) {
21-
[]<::beman::execution::detail::valid_completion_for<Receiver>... Signatures>(
22-
::beman::execution::completion_signatures<Signatures...>*) {}(completions);
23-
};
27+
struct has_completions_impl : std::false_type {};
28+
29+
template <typename Receiver, ::beman::execution::detail::valid_completion_for<Receiver>... Signatures>
30+
struct has_completions_impl<Receiver, ::beman::execution::completion_signatures<Signatures...>> : std::true_type {};
31+
32+
template <typename Receiver, typename Completions>
33+
concept has_completions = has_completions_impl<Receiver, Completions>::value;
34+
2435
} // namespace beman::execution::detail
2536

2637
// ----------------------------------------------------------------------------

tests/beman/execution/exec-scope-concepts.test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ static_assert(not std::copyable<non_copyable>);
3232

3333
struct empty {};
3434

35-
template <test_std::sender S>
35+
template <typename S>
3636
struct wrap {
3737
using sender_concept = test_std::sender_t;
3838
std::remove_cvref_t<S> sndr;

0 commit comments

Comments
 (0)