https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107862
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I don't think this is valid code. In the function dynamic_data_to_array you have: std::array<VT, test.size()> data; But test.size() is not a constexpr unless test is a constexpr. making test a constexpr does not work as it has dynamic allocation In your Test struct you have: constexpr unsigned size() const { return 1; } So it is always a constexpr ... Note clang also rejects this code for the same reason as GCC even with libc++.