https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105301
Bug ID: 105301 Summary: [12 Regression] ICE: tree check: expected tree that contains 'decl minimal' structure, have 'overload' in coro_promise_type_found_p, at cp/coroutines.cc:516 Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: C++-Coroutine, ice-on-invalid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com CC: iains at gcc dot gnu.org Target Milestone: --- Created attachment 52825 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52825&action=edit Testcase g++ 12.0.1 20220417 snapshot (g:000c1b89d259fadb466e1f2e63c79da45fd17372) ICEs when compiling the attached testcase, reduced from clang/testsuite/SemaCXX/coroutines.cpp from the clang 14.0.1 test suite, w/ -fcoroutines: % g++-12.0.1 -fcoroutines -c lvhljakz.cpp lvhljakz.cpp: In function 'coro<bad_promise_6> bad_implicit_return()': lvhljakz.cpp:43:21: error: the coroutine promise type 'std::coroutine_traits<coro<bad_promise_6> >::promise_type' {aka 'bad_promise_6'} declares both 'return_value' and 'return_void' 43 | coro<bad_promise_6> bad_implicit_return() { co_await a; } | ^~~~~~~~~~~~~~~~~~~ lvhljakz.cpp:39:8: note: 'return_void' declared here 39 | void return_void(); | ^~~~~~~~~~~ lvhljakz.cpp:43:54: internal compiler error: tree check: expected tree that contains 'decl minimal' structure, have 'overload' in coro_promise_type_found_p, at cp/coroutines.cc:516 43 | coro<bad_promise_6> bad_implicit_return() { co_await a; } | ^ 0x8796d0 tree_contains_struct_check_failed(tree_node const*, tree_node_structure_enum, char const*, int, char const*) /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/tree.cc:8972 0x692cd6 contains_struct_check(tree_node*, tree_node_structure_enum, char const*, int, char const*) /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/tree.h:3571 0x692cd6 coro_promise_type_found_p /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/coroutines.cc:516 0x9b2693 finish_co_await_expr(unsigned int, tree_node*) /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/coroutines.cc:1165 0xaf9271 cp_parser_unary_expression /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:8866 0xac7237 cp_parser_binary_expression /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:10035 0xac7e2e cp_parser_assignment_expression /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:10339 0xac991c cp_parser_expression /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:10509 0xacd017 cp_parser_expression_statement /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:12705 0xada2ca cp_parser_statement /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:12501 0xadb45d cp_parser_statement_seq_opt /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:12850 0xadb537 cp_parser_compound_statement /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:12802 0xafc145 cp_parser_function_body /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:25069 0xafc145 cp_parser_ctor_initializer_opt_and_function_body /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:25120 0xafd0fa cp_parser_function_definition_after_declarator /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:31251 0xafe3b8 cp_parser_function_definition_from_specifiers_and_declarator /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:31167 0xafe3b8 cp_parser_init_declarator /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:22591 0xad7ee9 cp_parser_simple_declaration /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:15280 0xb09675 cp_parser_declaration /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:14966 0xb0a039 cp_parser_toplevel_declaration /var/tmp/portage/sys-devel/gcc-12.0.1_p20220417/work/gcc-12-20220417/gcc/cp/parser.cc:14987