This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/78842] "error: declaration of 'bool icase' shadows a parameter" should be warning
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 20 Dec 2016 23:02:42 +0000
- Subject: [Bug c++/78842] "error: declaration of 'bool icase' shadows a parameter" should be warning
- Auto-submitted: auto-generated
- References: <bug-78842-4@http.gcc.gnu.org/bugzilla/>
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
}
}