https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68374
xyzdragon at fastmail dot fm changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #3 from xyzdragon at fastmail dot fm --- (In reply to Paolo Carlini from comment #1) > This is already fixed in trunk. I'm adding a testcase and closing the bug. What do you mean with trunk? It still doesn't warn for g++-4.9 (Debian 4.9.4-2) 4.9.4` g++-5 (Debian 5.4.1-4) 5.4.1 20161202` g++-5 (Debian 5.5.0-8) 5.5.0 20171010` g++-6 (Debian 6.3.0-18) 6.3.0 20170516` g++-6 (Debian 6.4.0-12) 6.4.0 20180123` g++-7 (Debian 7.2.0-16) 7.2.0` g++-7 (Debian 7.3.0-3) 7.3.0` Ah okay this version does work: g++-8 (Debian 8-20180207-2) 8.0.1 20180207 (experimental) [trunk revision 257435] although I don't see why this can't be a minor version bugfix in the older major versions: shadowtest.cpp: In member function ‘int f::g(int)’: shadowtest.cpp:3:24: warning: declaration of ‘mVar’ shadows a previous local [-Wshadow] int g(int x) { int mVar=3; return x+mVar; } ^~~~ shadowtest.cpp:2:16: note: shadowed declaration is here static int mVar; ^~~~ Btw offtopic, aren't all these major version upgrades too much too fast? I've lost quite a bit of time, because my system didn't work with g++5 (kernel module didn't compile), or because CUDA didn't, or because I had ABI-incompatibility bugs, because I linked code compiled with different compiler compilers accidentally and the list goes on ...