[C++ Patch] PR 68374 ("G++ -Wshadow doesn't warn about static member shadowing")
Paolo Carlini
paolo.carlini@oracle.com
Wed May 2 17:33:00 GMT 2018
Hi all, Jason,
On 24/04/2018 01:00, Paolo Carlini wrote:
> On 23/04/2018 23:43, Jason Merrill wrote:
>> On Mon, Apr 23, 2018 at 5:17 PM, Paolo Carlini
>> <paolo.carlini@oracle.com> wrote:
>>> Hi,
>>>
>>> this issue is by and large fixed in trunk, thus I wanted to resolve
>>> it as
>>> such, marking it as fixed for 8.1.0. However the text of the warning is
>>> misleading / wrong:
>>>
>>> Â Â Â Â declaration of âmVarâ shadows a previous local
>>>
>>> where in fact the shadowed declaration isn't local, is a static data
>>> member
>>> of the class. It seems to me that we should simply not handle such
>>> static
>>> old decls in the conditional block handling locals shadowing other
>>> locals,
>>> thus handle those below, together with other non-static member
>>> declarations.
>>> Tested x86-64-linux.
>> !TREE_STATIC seems like the wrong test here; that's also true for
>> static local variables.
>>
>> Maybe check DECL_FUNCTION_SCOPE_P instead?
> Indeed. I don't know how I mis-analyzed that block to conclude that
> previous static locals weren't handled at all there.
>
> Anyway, I added a testcase for that and I'm running again the full
> testsuite (g++.dg is Ok). Ok if it passes?
Is the amended patch Ok for trunk, now? To be clear: fully tested on
x86_64-linux.
   https://gcc.gnu.org/ml/gcc-patches/2018-04/msg01071.html
Thanks!
Paolo.
More information about the Gcc-patches
mailing list