]> 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>
Thu, 12 May 2022 21:14:42 +0000 (17:14 -0400)
commitb01044ec7fbed24e9394bcf49e524acdd52849e7
tree18fe3b3aa98df0f34d7d03b69f53a114667deaf2
parent6c69f7c449cc1c0d48e13b8680023a59f541260e
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]