https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89478
--- Comment #1 from Marc Glisse <glisse at gcc dot gnu.org> --- 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.