https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119123
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It doesn't have to be a ctor in which the first class is referenced, e.g.
struct S {
template <typename> void foo (int = [] {}) const;
};
struct T {
static void bar (const S &);
};
ICEs too. But method/static member function in the same class as foo doesn't
ICE,
nor does reference from a normal function.
And, adding static void bar (const S &); to struct S makes it not ICE as well,
even with the struct T and its static member function.