https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94034
--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Here is a rejects-valid testcase caused by the same underlying issue:
$ cat testcase.C
struct A { A *p = this; int n; };
constexpr A
foo()
{
return {};
}
constexpr A
bar()
{
A a = foo();
a.p->n = 5;
return a;
}
static_assert(bar().n == 5);
$ g++ -std=c++2a testcase.C
testcase.C:17:23: error: non-constant condition for static assertion
17 | static_assert(bar().n == 5);
| ~~~~~~~~^~~~
testcase.C:17:19: in ‘constexpr’ expansion of ‘bar()’
testcase.C:17:23: error: modification of ‘‘result_decl’ not supported by
dump_expr<expression error>’ is not a constant expression