https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116052
Bug ID: 116052 Summary: [15 Regression] ICE in diagnostic_context::diagnostic_impl Product: gcc Version: 15.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: curdeius at gmail dot com Target Milestone: --- An ICE occurs on current trunk (as of 2024-07-23). It works fine with GCC 14.1. Godbolt: https://godbolt.org/z/rq67Mnsrr The code is the example from https://wg21.link/P3090, page 4. Compiler output: ``` In file included from /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__transform_sender.hpp:21, from /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__senders.hpp:31, from /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__as_awaitable.hpp:26, from /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/execution.hpp:21, from <source>:5: /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__basic_sender.hpp: In instantiation of 'stdexec::__detail::__env_type_t<_Self, typename decltype (stdexec::__declval<__detail::__sexpr_apply_t>()(__declval<_Sexpr>(), stdexec::__declval<__detail::__sexpr_uncurry_fn<__q<__detail::__desc> > >()))::__tag, _Idx, _Sexpr, typename _ReceiverId::__t> stdexec::__detail::__receiver<_ReceiverId, _Sexpr, _Idx>::__t::get_env() const [with _Self = stdexec::__detail::__receiver<stdexec::__sync_wait::__receiver<int>, stdexec::__sexpr<<lambda closure object>stdexec::{anonymous}::<lambda()>(), stdexec::{anonymous}::__anon>, stdexec::__muchar (*)[1]>::__t; _ReceiverId = stdexec::__sync_wait::__receiver<int>; _Sexpr = stdexec::__sexpr<<lambda closure object>stdexec::{anonymous}::<lambda()>(), stdexec::{anonymous}::__anon>; _Idx = stdexec::__muchar (*)[1]]': /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__basic_sender.hpp:210:11: required from here 210 | get_env() const noexcept -> __env_type_t<_Self, __tag_t, _Idx, _Sexpr, _Receiver> { | ^~~~~~~ /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__basic_sender.hpp:210:11: error: use of built-in trait '__decay(decltype((stdexec::__sexpr_impl<typename stdexec::__i<_Ok<_Self, stdexec::__let::__let_t<stdexec::__rcvrs::set_value_t, stdexec::default_domain> >, true>::__g<stdexec::__msecond, _Self, stdexec::__let::__let_t<stdexec::__rcvrs::set_value_t, stdexec::default_domain> > >::get_state)(__declval()(), __declval()())))' in function signature; use library traits instead /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__basic_sender.hpp: In instantiation of 'stdexec::__detail::__env_type_t<_Self, typename decltype (stdexec::__declval<__detail::__sexpr_apply_t>()(__declval<_Sexpr>(), stdexec::__declval<__detail::__sexpr_uncurry_fn<__q<__detail::__desc> > >()))::__tag, _Idx, _Sexpr, typename _ReceiverId::__t> stdexec::__detail::__receiver<_ReceiverId, _Sexpr, _Idx>::__t::get_env() const [with _Self = stdexec::__detail::__receiver<stdexec::__sync_wait::__receiver<int>, stdexec::__sexpr<<lambda closure object>stdexec::{anonymous}::<lambda()>(), stdexec::{anonymous}::__anon>, stdexec::__muchar (*)[1]>::__t; _ReceiverId = stdexec::__sync_wait::__receiver<int>; _Sexpr = stdexec::__sexpr<<lambda closure object>stdexec::{anonymous}::<lambda()>(), stdexec::{anonymous}::__anon>; _Idx = stdexec::__muchar (*)[1]]': /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__basic_sender.hpp:210:11: required from here /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__basic_sender.hpp:210:11: error: use of built-in trait '__decay(decltype((stdexec::__sexpr_impl<typename stdexec::__i<_Ok<_Self, stdexec::__let::__let_t<stdexec::__rcvrs::set_value_t, stdexec::default_domain> >, true>::__g<stdexec::__msecond, _Self, stdexec::__let::__let_t<stdexec::__rcvrs::set_value_t, stdexec::default_domain> > >::get_state)(__declval()(), __declval()())))' in function signature; use library traits instead /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__basic_sender.hpp: In instantiation of 'stdexec::__detail::__env_type_t<_Index, typename __decay(_Ty)::__desc_t::__tag, _Index, _Sexpr, _Receiver> stdexec::__detail::__op_state<_Sexpr, _Receiver>::__get_env(_Index) const [with _Index = stdexec::__muchar (*)[1]; _Sexpr = stdexec::__sexpr<<lambda closure object>stdexec::{anonymous}::<lambda()>(), stdexec::{anonymous}::__anon>; _Receiver = stdexec::__sync_wait::__receiver<int>::__t]': /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__basic_sender.hpp:375:9: required from here 375 | __get_env(_Index) const noexcept | ^~~~~~~~~ /opt/compiler-explorer/libs/stdexec/trunk/include/stdexec/__detail/__basic_sender.hpp:375:9: internal compiler error: Segmentation fault 0x273c0c5 diagnostic_context::diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1], diagnostic_t) ???:0 0x2749cd5 internal_error(char const*, ...) ???:0 0xbb0c46 mangle_decl(tree_node*) ???:0 0x1709e25 decl_assembler_name(tree_node*) ???:0 0x1732841 assign_assembler_name_if_needed(tree_node*) ???:0 0xe9db5d cgraph_node::analyze() ???:0 0xea1111 symbol_table::finalize_compilation_unit() ???:0 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. Compiler returned: 1 ``` Source code (need to add library stdexec): ``` #include <cstdio> #include <string> #include <thread> #include <stdexec/execution.hpp> using namespace std::literals; // A simple event loop: stdexec::run_loop loop; std::thread worker([]{ loop.run(); }); int main() { using namespace stdexec; // An "async" operation that sends a string when complete sender auto hello = just("hello world"s); // A continuation that writes the string to cout: sender auto print = hello | then([](auto msg) { std::puts(msg.c_str()); return 0; // <-- result of the async operation }); // A scheduler for launching work on a separate io worker thread: scheduler auto io_thread = loop.get_scheduler(); // An async operation that runs on the separate io worker thread: sender auto work = on(io_thread, print); // Launch the work and wait for it to complete (this returns // and optional<tuple<int>>): auto [result] = sync_wait(work).value(); // Tell the loop we're not going to add more work: loop.finish(); // Wait for the worker thread to exit: worker.join(); return result; } ```