https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78147
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-03-17 CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed. Paul, please post your patch to gcc-patches. Personally, I think providing it under Clang's -Wunused-private-field for compatibility would be preferable to disabling the warning altogether. The top of trunk emits the following warning: $ cat t.C && gcc -S -Wshadow t.C class Foo { int foo; public: Foo(int foo) : foo(foo) {} }; t.C: In constructor ‘Foo::Foo(int)’: t.C:6:20: warning: declaration of ‘foo’ shadows a member of ‘Foo’ [-Wshadow] Foo(int foo) : foo(foo) {} ^ t.C:4:11: note: shadowed declaration is here int foo; ^~~ With -Weverything Clang emits the warnings below. t.C:6:15: warning: constructor parameter 'foo' shadows the field 'foo' of 'Foo' [-Wshadow-field-in-constructor] Foo(int foo) : foo(foo) {} ^ t.C:4:11: note: previous declaration is here int foo; ^ t.C:4:11: warning: private field 'foo' is not used [-Wunused-private-field] int foo; ^ 2 warnings generated.