Re: Spurious warnings generated by -Wshadow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Kevin P. Fleming" <kpfleming@xxxxxxxxxx> writes:

> The gcc manpage has this to say:
>
>> -Wshadow
>> Warn whenever a local variable shadows another local variable, parameter or global variable or whenever a built-in function is shadowed.
>
> However, compiling this code (with g++ 4.4.x or 4.5.x) using -Wshadow:
>
> class foo {
>         void baz() {
>         }
>
>         int bar(int baz) {
>         }
> };
>
> produces this diagnostic:
>
> test1.cpp: In member function âint foo::bar(int)â:
> test1.cpp:5: warning: declaration of âbazâ shadows a member of 'this'
>
> 'baz' is not a local variable, nor a parameter, nor a global variable
> or a built-in function. I'm not necessarily saying that this warning
> is not useful, but the manpage doesn't say anything about shadowing
> member functions being something that -Wshadow will warn about.
>
> Is the documentation just trailing the code here?

Yes.  It's a doc bug.

Ian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux