[Bug c++/38022] [4.4 regression, g++] Incorrect warning with -Wshadow

martin at mpa-garching dot mpg dot de gcc-bugzilla@gcc.gnu.org
Wed Nov 5 21:39:00 GMT 2008



------- Comment #2 from martin at mpa-garching dot mpg dot de  2008-11-05 21:37 -------
> Why do you think this is a bug?

> -Wshadow warns even for:
> int foo;
> int (*fn) (int foo);

I'm probably missing something obvious here...

The first line in your example defines an integer variable called "foo"
The second line defines a function called "fn", which takes an integer argument
and returns an integer. The name of the integer argument of "fn" should have no
significance at all in the current scope, but only inside the body of "fn"
itself, correct?

In short, whether I write
int (*fn)(int foo);
or
int (*fn)(int bar);
or
int (*fn)(int);
should make no difference (as far as I understand C++, and I could certainly be
wrong ...)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38022



More information about the Gcc-bugs mailing list