[Bug tree-optimization/89478] missed optimization for lambda expression when variable is uninitialized when declared
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89478 --- Comment #3 from SztfG at yandex dot ru --- Another testcase: int test4 = []() constexpr {int a = a; a = 5; return a;}(); GCC is able compile this, so it "think" this is valid constexpr lambda, but anyway doing this: _GLOBAL__sub_I_test4: movl$5, test4(%rip) ret test4: .zero 4
[Bug tree-optimization/89478] missed optimization for lambda expression when variable is uninitialized when declared
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89478 --- Comment #2 from SztfG at yandex dot ru --- (In reply to Marc Glisse from comment #1) > I think the uninitialized variable makes the initialization not constexpr > (and indeed gcc/clang complain if you try to declare test constexpr). Then > we hit the well-known missed optimization that gcc is unable to convert a > dynamic initialization into a static initialization even in the most trivial > constant cases. Then need to mark this bug as duplicate, but where that bug in GCC bugzilla, which about that well-known missed optimization?
[Bug tree-optimization/89478] missed optimization for lambda expression when variable is uninitialized when declared
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89478 --- Comment #1 from Marc Glisse --- I think the uninitialized variable makes the initialization not constexpr (and indeed gcc/clang complain if you try to declare test constexpr). Then we hit the well-known missed optimization that gcc is unable to convert a dynamic initialization into a static initialization even in the most trivial constant cases.