https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94951
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- And the array isn't needed either: struct A { int a; }; template <int N> struct B : public A { static B<N> foo () { B<N> t; t.a = 4; return t; } };