gcc -Wshadow is too strict?

Posted by idimba on Stack Overflow See other posts from Stack Overflow or by idimba
Published on 2010-06-02T14:05:34Z Indexed on 2010/06/02 14:24 UTC
Read the original article Hit count: 171

Filed under:
|
|

In the following example:

class A
{
    int len();
    void setLen(int len) { len_ = len; } // warning at this line

    int len_;
};

gcc with -Wshadow issue a warning:

main.cpp:4: warning: declaration of `len' shadows a member of `this'

function len and integer len are of different type. Why the warning?

© Stack Overflow or respective owner

Related posts about c++

Related posts about gcc