https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121445
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Or maybe better testcase:
struct D {
const char *d;
const char *foo () { return ""; };
constexpr D () : d (foo ()) {}
constexpr D &operator= (const char *) { return *this; }
};
struct S {
constexpr S ()
{
struct A { D a; };
struct B { A b; };
struct C { B c; };
C d {};
d.c.b.a = "";
}
};
because the above one is self-recursive (the S constructor invoking S
constructor in it, which for constexpr evaluation is a problem).
Anyway, the problem is that build_constexpr_constructor_member_initializers ->
build_data_member_initialization attempts to match random statements inside of
the ctor body as if they had to be member initializers.