https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99132
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- We certainly can (and IMHO should) do: --- gcc/cp/cp-gimplify.c.jj 2021-02-10 07:52:32.702901304 +0100 +++ gcc/cp/cp-gimplify.c 2021-02-17 16:06:03.045953720 +0100 @@ -1386,7 +1386,7 @@ cp_genericize_r (tree *stmt_p, int *walk break; } - if (tree fndecl = cp_get_callee_fndecl (stmt)) + if (tree fndecl = cp_get_callee_fndecl_nofold (stmt)) if (DECL_IMMEDIATE_FUNCTION_P (fndecl)) { gcc_assert (source_location_current_p (fndecl)); because addresses of immediate functions shouldn't be leaking in the IL anywhere and so only direct calls to them are possible. The strange thing is why it ICEs only with -std=c++20...