https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105798
Bug ID: 105798 Summary: Add new -Wshadow for data member Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tromey at gcc dot gnu.org Target Milestone: --- While refactoring gdb -- changing a function to a method -- I accidentally introduced a self-assign, because the function used local variables that had the same name as the class members. gdb uses -Wshadow=local... I don't recall why but it seems like it would be nice to have a level between 'local' and 'global' so we could prevent locals from shadowing class members but still not care about globals. Test case: struct x { int f; int y(int x) { int f = x; return f; } }; This warns with -Wshadow but not -Wshadow=local.