c++: -Wshadow=compatible-local type vs var [PR100608]
commitfd0024e48e94008915a6b18112efbbd8abc81ed8
authorJason Merrill <jason@redhat.com>
Tue, 5 Apr 2022 20:02:04 +0000 (5 16:02 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 6 Apr 2022 14:30:12 +0000 (6 10:30 -0400)
tree8e261348e8d5b2a5beb45f0b8f19595ffd282a8d
parente1a5e7562d53a8d2256f754714b06595bea72196
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.cc (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.cc
gcc/testsuite/g++.dg/warn/Wshadow-compatible-local-3.C [new file with mode: 0644]