This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/78842] "error: declaration of 'bool icase' shadows a parameter" should be warning


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78842

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Presumably you had a local variable 'icase' in your function, because you
wouldn't get a diagnostic saying "shadows a parameter" for a global variable.
That's impossible.

It's an error if the local variable is in the outermost block of the function,
because it declares two variables of the same name in the same scope:

void find_vsizet(bool icase=false)
{
        bool icase = false;  // error
        {
                bool icase = false;  // ok here, only a warning
        }
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]