Skip to content

Conversation

@anonymouspc
Copy link

@anonymouspc anonymouspc commented Aug 28, 2025

Recently I'm trying to compile beman/execution into C++20 Modules:

module;
#include <beman/execution/execution.hpp>
#include <beman/execution/functional.hpp>
#include <beman/execution/stop_token.hpp>
export namespace beman::execution
{
    using beman::execution::sender;
    /*using...*/
}

while g++ complains about one exposes TU-local entity:

error: ‘using std::conditional_t = typename std::conditional<same_as<typename beman::execution::detail::completion_domain_merge<typename beman::execution::detail::completion_domain_merge<decltype (get(beman::execution::set_error)), decltype (get(beman::execution::set_stopped))>::type, decltype (get(beman::execution::set_value))>::type, beman::execution::detail::completion_domain_undefined>, Default, typename beman::execution::detail::completion_domain_merge<typename beman::execution::detail::completion_domain_merge<decltype (get(beman::execution::set_error)), decltype (get(beman::execution::set_stopped))>::type, decltype (get(beman::execution::set_value))>::type>::type’ exposes TU-local entity ‘struct std::conditional<same_as<typename beman::execution::detail::completion_domain_merge<typename beman::execution::detail::completion_domain_merge<decltype (get(beman::execution::set_error)), decltype (get(beman::execution::set_stopped))>::type, decltype (get(beman::execution::set_value))>::type, beman::execution::detail::completion_domain_undefined>, Default, typename beman::execution::detail::completion_domain_merge<typename beman::execution::detail::completion_domain_merge<decltype (get(beman::execution::set_error)), decltype (get(beman::execution::set_stopped))>::type, decltype (get(beman::execution::set_value))>::type>’

in beman/execution/detail/completion_domain.hpp.

When we look into completion_domain.hpp, here

  • get is a function-local lambda with local captures (that is to say, is TU-local)
  • TU-local entities will indirectly affect all the entities which depends on it to be not module-exportable after P1815. Here, the templates of using type = ...; return std::conditional<...type...>; are infected as TU-local.

So I made a tiny change on get function, making it constexpr and exportable.

Thank you! This is an amazing library (super tidy!!) and I'll star it.

When trying to compile `beman/execution` into `C++20 Modules`, g++ complains about `exposes TU-local entity get(...)` in `beman/execution/detail/completion_domain.hpp`, where
- `get` is defined to do compile-time type calculation
- `get` is a function-local lambda with local captures (that is to say, is TU-local)
- TU-local entities will indirectly affect all the entities which depends on it to be not `module-exportable`.
So we made a tiny change on `get` function, making it `constexpr` and `exportable`.
Copy link
Member

@dietmarkuehl dietmarkuehl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change seems like an improvement, i.e., I'll and it. However, I want to avoid lambdas in headers. Sadly, I didn't realise that when I started implementing the library and there are obviously some still there. I'll change that to use a struct instead.

I also wanted to provide suitable modules declaration. However, when I last tried compilers and/or the build system weren't quite ready.

Thanks!

@coveralls
Copy link

Coverage Status

coverage: 92.436%. remained the same
when pulling 793f452 on anonymouspc:main
into a5843eb on bemanproject:main.

@dietmarkuehl dietmarkuehl merged commit 4ca7476 into bemanproject:main Aug 28, 2025
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants