https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94829
Bug ID: 94829 Summary: ICE in poplevel, at cp/decl.c:585 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com Target Milestone: --- Created attachment 48395 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48395&action=edit Testcase g++-10.0.1-alpha20200426 snapshot (g:29f55115583a0dab6cbac749c4f0804fd88e9536) ICEs when compiling the attached testcase w/ -fcoroutines: % g++-10.0.1 -fcoroutines -c clang/test/CodeGenCoroutines/coro-lambda.cpp clang/test/CodeGenCoroutines/coro-lambda.cpp: In instantiation of 'auto SyncAwait(_AwrT&&) [with _AwrT = suspend_always&]': clang/test/CodeGenCoroutines/coro-lambda.cpp:50:17: required from here clang/test/CodeGenCoroutines/coro-lambda.cpp:41:20: error: coroutines require a traits template; cannot find 'std::coroutine_traits' 41 | try { (void)(co_await A); } catch (...) {} | ~^~~~~~~~~~~ clang/test/CodeGenCoroutines/coro-lambda.cpp:41:20: note: perhaps '#include <coroutine>' is missing clang/test/CodeGenCoroutines/coro-lambda.cpp:43:26: internal compiler error: in poplevel, at cp/decl.c:585 43 | Task t = AwaitAsync(); | ^ 0x6138a0 poplevel(int, int, int) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/decl.c:585 0xa2ecab do_poplevel(tree_node*) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/semantics.c:453 0xa329d9 finish_compound_stmt(tree_node*) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/semantics.c:1542 0x9f38c0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/pt.c:18145 0x9f3f7b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/pt.c:18109 0x9f1312 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/pt.c:17821 0x9f1662 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/pt.c:18140 0x9ee76a instantiate_decl(tree_node*, bool, bool) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/pt.c:25688 0x91fbda maybe_instantiate_decl /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/decl2.c:5370 0x922418 maybe_instantiate_decl /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/tree.h:3402 0x922418 mark_used(tree_node*, int) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/decl2.c:5577 0x875e72 build_over_call /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/call.c:9048 0x87800c build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/call.c:4599 0xa36734 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/semantics.c:2672 0x9ad191 cp_parser_postfix_expression /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:7468 0x98eb69 cp_parser_binary_expression /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:9557 0x99081e cp_parser_assignment_expression /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:9862 0x990be3 cp_parser_expression /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:10030 0x993c38 cp_parser_expression_statement /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:11691 0x99f253 cp_parser_statement /var/tmp/portage/sys-devel/gcc-10.0.1_alpha20200426/work/gcc-10-20200426/gcc/cp/parser.c:11487 The testcase is unmodified test/CodeGenCoroutines/coro-lambda.cpp from the clang 10.0.0 testsuite. clang++ 9.0.1 accepts it. I don't really see much opportunities for reduction here.