https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94537
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Simpler runtime testcase:
$ cat testcase.C
struct A { A *p = this; int m = 1; };
A
foo()
{
return {};
}
int
main()
{
A a = foo();
a.p->m++;
if (a.m != 2)
__builtin_abort ();
}
$ g++ -std=c++17 testcase.C
$ ./a.out
zsh: abort ./a.out
