Created attachment 55469 [details] self-contained source file Compile the attached source with -std=c++20. Result: /home/eniebler/hello_world.cpp: In substitution of ‘template<class _EnvProvider> requires tag_invocable<stdexec::__env::get_env_t, const _EnvProvider&> constexpr stdexec::__tag_invoke::tag_invoke_result_t<stdexec::__env::get_env_t, const _EnvProvider&> stdexec::__env::get_env_t::operator()(const _EnvProvider&) const [with _EnvProvider = stdexec::__basic_sender<<lambda(_Data, _Children ...)>::<lambda(_Cvref, _Fun&&)> >]’: /home/eniebler/hello_world.cpp:2221:16: required from here /home/eniebler/hello_world.cpp:1465:59: internal compiler error: in maybe_instantiate_noexcept, at cp/pt.cc:26753 1465 | requires(_Tag __tag, _Args&&... __args) { tag_invoke((_Tag&&) __tag, (_Args&&) __args...); }; | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0xace10a maybe_instantiate_noexcept(tree_node*, int) ../../gcc/cp/pt.cc:26753 0x96272f mark_used(tree_node*, int) ../../gcc/cp/decl2.cc:5720 0x864a35 build_over_call ../../gcc/cp/call.cc:10394 0x867e0b build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) ../../gcc/cp/call.cc:5038 0xb304ff finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc/cp/semantics.cc:2924 0xacc4e5 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.cc:21338 0xabb964 tsubst_expr(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.cc:19888 0x8c3193 tsubst_valid_expression_requirement ../../gcc/cp/constraint.cc:2002 0x8cc3c0 tsubst_simple_requirement ../../gcc/cp/constraint.cc:2036 0x8cc3c0 tsubst_requirement ../../gcc/cp/constraint.cc:2233 0x8cc3c0 tsubst_requires_expr ../../gcc/cp/constraint.cc:2363 0x8cc8aa tsubst_requires_expr(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/constraint.cc:2382 0xac96c7 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.cc:21749 0xabb964 tsubst_expr(tree_node*, tree_node*, int, tree_node*) ../../gcc/cp/pt.cc:19888 0x8cde63 satisfy_atom ../../gcc/cp/constraint.cc:3041 0x8cde63 satisfy_constraint_r ../../gcc/cp/constraint.cc:3106 0x8ce723 satisfy_normalized_constraints ../../gcc/cp/constraint.cc:3131 0x8caefd satisfy_declaration_constraints ../../gcc/cp/constraint.cc:3352 0x8caefd constraint_satisfaction_value ../../gcc/cp/constraint.cc:3373 0x8ce78f constraints_satisfied_p(tree_node*, tree_node*) ../../gcc/cp/constraint.cc:3410 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. See https://godbolt.org/z/1511TYvch for a demo of the bug on compiler explorer.
reducing ...
Looks like it is a lambda inside a decltype is causing it.
Created attachment 55470 [details] reduced but invalid code This is the reduced testcase I got but it became invalid code; maybe the original is invalid too. But clang's error message is: <source>:31:25: error: member reference base type '__tag_t' (aka 'void') is not a structure or union 31 | noexcept(__tag_t().get_env(__self))) {} | ~~~~~~~~~^~~~~~~~ <source>:30:15: note: in instantiation of exception specification for 'tag_invoke<stdexec::__env::get_env_t, stdexec::__basic_sender<stdexec::(lambda at <source>:33:25)>>' requested here 30 | friend auto tag_invoke(_Tag, const _Self &__self) noexcept( | ^ <source>:6:14: note: in instantiation of function template specialization 'stdexec::tag_invoke<stdexec::__env::get_env_t, stdexec::__basic_sender<stdexec::(lambda at <source>:33:25)>>' requested here 6 | decltype(tag_invoke(__declval<_Tag>(), __declval<_Args>()...)); | ^ <source>:13:10: note: in instantiation of template type alias 'tag_invoke_result_t' requested here 13 | -> tag_invoke_result_t<get_env_t, const _EnvProvider &> {} | ^ <source>:19:36: note: while substituting deduced template arguments into function template 'operator()' [with _EnvProvider = stdexec::__basic_sender<stdexec::(lambda at <source>:33:25)>] 19 | { get_env(__ep) }; | ^ <source>:19:36: note: in instantiation of requirement here 19 | { get_env(__ep) }; | ^~~~~~~~~~~~~ <source>:18:32: note: while substituting template arguments into constraint expression here 18 | concept environment_provider = requires(_EnvProvider &__ep) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 19 | { get_env(__ep) }; | ~~~~~~~~~~~~~~~~~~ 20 | }; | ~ <source>:35:15: note: while checking the satisfaction of concept 'environment_provider<stdexec::__basic_sender<stdexec::(lambda at <source>:33:25)>>' requested here 35 | static_assert(stdexec::environment_provider<S>); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Created attachment 55471 [details] changed slightly to produce valid code
Confirmed.
(In reply to Andrew Pinski from comment #2) > Looks like it is a lambda inside a decltype is causing it. The reason why I say that is if I change __apply_fn's operator() not to take a second argument and remove the lambda from the call to it in __tag_from, then this works.
Fixed on the trunk for GCC 14 by the recent lambda template patches.