https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70723
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- With -std=c++17 (which is the default now), the code is optimized as expected. With -std=c++14, the dynamic initializer comes into play; there are a few other bugs dealing with that already too.