P3826R4 adds the following paragraph to [exec.snd.expos]:
- For a pack of subexpressions domains, COMMON-DOMAIN(domains...) is expression-equivalent to
common_type_t<decltype(auto(domains))...>() if that expression is well-formed, and indeterminate_domain<Ds...>() otherwise, where Ds is the pack of types consisting of decltype(auto(domains))... with duplicate types removed.
my intention with this paragraph was that two domains such as below would have a COMMON-DOMAIN of default_domain:
struct my_thread_pool_domain : std::execution::default_domain
{};
struct my_parallel_runtime_domain : std::execution::default_domain
{};
using domain-t = decltype(COMMON-DOMAIN(my_thread_pool_domain{}, my_parallel_runtime_domain{}));
static_assert(std::same_as<domain-t, default_domain>); // FAILS
but that's not how common_type_t works. even though both domains derive from default_domain, they do not have a common type as determined by common_type_t.
we can patch this up easily enough: if common_type_t<Domains...> is ill-formed, we should check if common_type_t<default_domain, Domains...> is well-formed. this will correctly handle the case when all the domains are convertible to default_domain.
Proposed Resolution
Change [exec.snd.expos]/p6 as follows:
6. For a pack of subexpressions domains, COMMON-DOMAIN(domains...) is
expression-equivalent to common_type_t<decltype(auto(domains))...>()
- if that expression is well-formed,
+ if that expression is well-formed; otherwise,
+ common_type_t<default_domain(), decltype(auto(domains))...>() if that
+ expression is well-formed;
and indeterminate_domain<Ds...>() otherwise, where Ds is the pack of
types consisting of decltype(auto(domains))... with duplicate types
removed.
P3826R4 adds the following paragraph to [exec.snd.expos]:
my intention with this paragraph was that two domains such as below would have a
COMMON-DOMAINofdefault_domain:but that's not how
common_type_tworks. even though both domains derive fromdefault_domain, they do not have a common type as determined bycommon_type_t.we can patch this up easily enough: if
common_type_t<Domains...>is ill-formed, we should check ifcommon_type_t<default_domain, Domains...>is well-formed. this will correctly handle the case when all the domains are convertible todefault_domain.Proposed Resolution
Change [exec.snd.expos]/p6 as follows:
6. For a pack of subexpressions domains, COMMON-DOMAIN(domains...) is expression-equivalent to common_type_t<decltype(auto(domains))...>() - if that expression is well-formed, + if that expression is well-formed; otherwise, + common_type_t<default_domain(), decltype(auto(domains))...>() if that + expression is well-formed; and indeterminate_domain<Ds...>() otherwise, where Ds is the pack of types consisting of decltype(auto(domains))... with duplicate types removed.