https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115670
--- Comment #7 from Federico Kircheis <federico at kircheis dot it> --- I've made a similar report to clang (https://github.com/llvm/llvm-project/issues/97162) and they found another function that could be optimized out ~~~ auto foo7() { return 1; } ~~~ They made me also realize that optimizing foo6 might be more complicated than I thought initially (keyword: function pointers)