This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Declaration shadows a parameter?
- To: egcs-bugs at cygnus dot com
- Subject: Declaration shadows a parameter?
- From: Marat Boshernitsan <maratb at CS dot Berkeley dot EDU>
- Date: 01 Mar 1998 19:20:02 -0800
Hi,
I am having trouble compiling the following piece of code with
egcs1.0.1. The error message is
closuretest.cc:17: declaration of `argc' shadows a parameter
but, I cannot find a relevant place in C++ standard that prohibits this.
Is this a bug in egcs? Any help would be appreciated. Thanks,
-- Marat
P.S. Please CC me on the reply as I only read this mailing list through
the web site. Thanks.
#include <stdio.h>
class Closure {
public:
virtual void apply() = 0;
};
void foo(Closure *cl) {
cl->apply();
}
int main(int argc, char **argv) {
class TempClosure : public Closure {
public:
virtual void apply() {
int argc = 42;
printf("%d\n", argc);
}
};
TempClosure tc;
foo(&tc);
return 0;
}