https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103819
--- Comment #3 from Daniel Bertalan <dani at danielbertalan dot dev> --- Here's an even smaller test case (https://gcc.godbolt.org/z/ee9GceMx3): === template <typename T> struct Optional { ~Optional() { if (m_has_value) value(); } T value(); bool m_has_value{}; }; __attribute__((flatten)) int main(){ Optional<Optional<int>> _temporary_result{}; return 0; } === during IPA pass: inline <source>:12:1: internal compiler error: in redirect_callee, at cgraph.cc:1389 12 | } | ^ 0x215b739 internal_error(char const*, ...) ???:0 0x73b7e7 fancy_abort(char const*, int, char const*) ???:0 0xbe2bbe cgraph_edge::redirect_callee(cgraph_node*) ???:0 0xe6b781 ipa_merge_fn_summary_after_inlining(cgraph_edge*) ???:0 0xe85396 inline_call(cgraph_edge*, bool, vec<cgraph_edge*, va_heap, vl_ptr>*, int*, bool, bool*) ???:0