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

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Dec 20 23:02:00 GMT 2016


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
        }
}


More information about the Gcc-bugs mailing list