https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86182
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
Status|UNCONFIRMED |NEW
Known to work| |7.3.1
Version|unknown |8.1.1
Keywords| |accepts-invalid,
| |ice-on-invalid-code
Last reconfirmed| |2018-06-18
Ever confirmed|0 |1
Summary|gcc crashes when compiling |[8/9 Regression] gcc
|the code |crashes when compiling the
| |code
Target Milestone|--- |8.2
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. GCC 7 rejects it:
> g++-7 t.C -S
t.C: In instantiation of ‘const char* f(T*) [with T = main()::<unnamed
union>]’:
t.C:11:32: required from here
t.C:5:4: error: use of local variable with automatic storage from containing
function
u.x = "hello world";
~~^
t.C:4:4: note: ‘main()::<unnamed union> <anonymous>’ declared here
T u(*t);
^
t.C:6:19: error: use of local variable with automatic storage from containing
function
printf("%s\n", u.x);
~~^
t.C:4:4: note: ‘main()::<unnamed union> <anonymous>’ declared here
T u(*t);
^