https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57346
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Status|UNCONFIRMED |NEW Last reconfirmed| |2016-07-22 CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 Known to fail| |4.5.3, 4.8.3, 4.9.3, 5.3.0, | |6.1.0, 7.0 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed. Both Clang 3.8 and EDG eccp 4.11 successfully compile the code. GCC apparently never has. $ cat y.C && /build/gcc-trunk-git/gcc/xgcc -B /build/gcc-trunk-git/gcc -S -Wall -Wextra -Wpedantic y.C template<typename T> int f() { T n = 0; struct X { int get() { return n; } } x; return x.get(); } y.C: In member function ‘int f()::X::get()’: y.C:3:35: error: use of local variable with automatic storage from containing function struct X { int get() { return n; } } x; ^ y.C:2:7: note: ‘T n’ declared here T n = 0; ^