]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++: -Wshadow=compatible-local type vs var [PR100608]
authorJason Merrill <jason@redhat.com>
Tue, 5 Apr 2022 20:02:04 +0000 (16:02 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 12 Apr 2022 20:12:49 +0000 (16:12 -0400)
commitc52cd0b35d356565f67f7956f4defc022dfa2172
tree18f77c06a4457eb9d5b1f2bd06ff08ddfcfcebd3
parent556d061e62ea863c7f99129219ca69bf0792c7f1
c++: -Wshadow=compatible-local type vs var [PR100608]

The patch for PR92024 changed -Wshadow=compatible-local to warn if either
new or old decl was a type, but the rationale only talked about the case
where both are types.  If only one is, they aren't compatible.

PR c++/100608

gcc/cp/ChangeLog:

* name-lookup.c (check_local_shadow): Use -Wshadow=local
if exactly one of 'old' and 'decl' is a type.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wshadow-compatible-local-3.C: New test.
gcc/cp/name-lookup.c
gcc/testsuite/g++.dg/warn/Wshadow-compatible-local-3.C [new file with mode: 0644]