[gnu.g++.bug] `this' is read-only in 1.36.0

kimber@kimber.ai.mit.edu (Don Kimber EIL) (08/17/89)

In version 1.36.0- on a Sun 4, running 4.0.1, the program foo.cc


  class cl* my_allocater(int size);
  void my_free(class cl* ptr);

  class cl {
  public:
     cl() {
       this = my_allocater( sizeof(cl) );
     };
     ~cl() {
       my_free( this );
       this = 0;
     };
  };

Gets the following errors
% g++ -v foo.cc
g++ version 1.36.0-
 /import/lib/gcc-cpp -+ -v -undef -D__GNU__ -D__GNUG__ -D__GNUC__ -D__cplusplus
-Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ foo.cc /tmp/cca02559.cpp
GNU CPP version 1.35.96
 /import/lib/gcc-cc1plus /tmp/cca02559.cpp -quiet -dumpbase foo.cc -noreg -versi
on -o /tmp/cca02559.s
GNU C++ version 1.36.0- (sparc) compiled by GNU C version 1.35.96.
default target switches: -mfpu -mepilogue
foo.cc: In method cl::cl ():
foo.cc:7: assignment of read-only parameter `$this'
foo.cc: In method cl::~cl ():
foo.cc:10: assignment of read-only parameter `$this'


Don Kimber