https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93048
--- Comment #1 from Pilar Latiesa <pilarlatiesa at gmail dot com> --- Reduced: #include <valarray> template<typename T> class valarray {}; template<int d, int r1> struct TTensor {}; template<int d, int r> struct TCoefs { double aP; std::valarray<double> aF; TTensor<d, r> b; }; template<int d, int r> class TCampo {}; template<int d, int r> class TExprDiv { private: TCampo<d, r> const &U; TCampo<d, r> const &fi; public: TExprDiv(TCampo<d, r> const &U_, TCampo<d, r> const &fi_): U(U_), fi(fi_) {} TCoefs<d, r> CalcCoefs(int) const; }; template<int d, int r> TCoefs<d, r> TExprDiv<d, r>::CalcCoefs(int) const { double aP = 0.0; std::valarray<double> aF; TTensor<d, r> b = {}; return {aP, aF, b}; } int main() { TCampo<2u, 1u> U; auto bar = TExprDiv<2u, 1u>(U, U).CalcCoefs(0); return 0; } I could not remove the dependency on the valarray header. It seems that TCoefs needs to have this members for the ICE to happen.