This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Declaration shadows a parameter?



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]