https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114452
--- Comment #2 from Paweł Bylica <chfast at gmail dot com> ---
I don't think this is related to lambdas. The following is also not optimized:
using F = int (*)(int) noexcept;
inline int impl(int x) noexcept { return x; }
void test(int z[2]) noexcept {
static constexpr F fs[]{
impl,
impl,
};
for (int i = 0; i < 2; ++i) {
z[i] = fs[i](z[i]);
}
}
https://godbolt.org/z/9hPbzo4Px
