https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63181
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #5)
> (In reply to Eric Gallager from comment #4)
> > This one should be moved to its own separate option per bug 7651
>
> Indeed it should, and if we add -Wdangling-field then that would be the
> ideal option to move it to.
Since GCC 12:
<source>: In constructor 'Foo::Foo(int)':
<source>:2:16: warning: storing the address of local variable 'x' in
'*this.Foo::x_' [-Wdangling-pointer=]
2 | Foo(int x): x_(x) { }
| ^~~~~
<source>:2:12: note: 'x' declared here
2 | Foo(int x): x_(x) { }
| ~~~~^
<source>:2:12: note: '<unknown>' declared here