https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121094
Bug ID: 121094 Summary: ICE on `co_await (obj->*func)(args...)` Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: dprokoptsev at gmail dot com Target Milestone: --- Created attachment 61869 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61869&action=edit Preprocessed source Current g++ (built from commit d8680bac95c) ICEs when trying to build a test suite for a coroutine library: /home/dmitryp/src/corral/test/../corral/Nursery.h:795:43: internal compiler error: in gimple_add_tmp_var, at gimplify.cc:837 795 | co_await (obj->*c)(std::move(a)...); | ~~~~~~~~~^~~~~~~~~~~~~~~~~ 0x358ccca internal_error(char const*, ...) ../../gcc/diagnostic-global-context.cc:517 0x354a6bf fancy_abort(char const*, int, char const*) ../../gcc/diagnostic.cc:1818 0x15f7b72 gimple_add_tmp_var(tree_node*) ../../gcc/gimplify.cc:837 0x1613575 gimplify_target_expr ../../gcc/gimplify.cc:8368 0x16499b8 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:20192 0x164ac67 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:20550 0x1648723 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:19910 0x164ac67 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:20550 0x1648723 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:19910 0x160f20f gimplify_modify_expr ../../gcc/gimplify.cc:7337 0x1647e4d gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:19789 0x1613a59 gimplify_stmt(tree_node**, gimple**) ../../gcc/gimplify.cc:8461 0x160a029 gimplify_cond_expr ../../gcc/gimplify.cc:5658 0x1647cc9 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:19743 0x1613a59 gimplify_stmt(tree_node**, gimple**) ../../gcc/gimplify.cc:8461 0x1609205 gimplify_cond_expr ../../gcc/gimplify.cc:5536 0x1647cc9 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:19743 0xd71e3b gimplify_to_rvalue ../../gcc/cp/cp-gimplify.cc:556 0xd72de3 cp_gimplify_expr(tree_node**, gimple**, gimple**) ../../gcc/cp/cp-gimplify.cc:796 0x1647a93 gimplify_expr(tree_node**, gimple**, gimple**, bool (*)(tree_node*), int) ../../gcc/gimplify.cc:19695 FWIW, splitting the expression to `auto x = (obj->*c)(std::move(a)...); co_await std::move(x)` resolves the issue. Also this used to work on gcc-14, and is apparently broken in gcc-15 and gcc-16. See the attached preprocessed source; I was not able to come up with a minimal repro so far (but will try further).