Declaration shadows a parameter?
Marat Boshernitsan
maratb@CS.Berkeley.EDU
Sun Mar 1 19:20:00 GMT 1998
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;
}
More information about the Gcc-bugs
mailing list