Spurious warnings generated by -Wshadow

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

 



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?

--
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
Jabber: kfleming@xxxxxxxxxx | SIP: kpfleming@xxxxxxxxxx | Skype: kpfleming
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at www.digium.com & www.asterisk.org



[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