C++ front end ignores constness in sometimes

Wolfgang Bangerth wolf@gaia.IWR.Uni-Heidelberg.De
Wed Feb 24 01:53:00 GMT 1999


Hi there,

egcs 1.1.1 misses to warn about violated constness in the following code
snippet:

-----------------------
class Y 
{
  public:
    void f(const int);
};


void Y::f(int x)
{
  x = 1;
};
------------------------

The problem seems to be that it decides that the signatures of the
declaration and the definition of Y::f are equal, which to the outside
world is true since the parameter is copied. However, it then allows to
write to "x".

This is nothing serious, I just wanted to let you know. Which I can also
take as opportunity to thank you for egcs, which thank is really in place!

Regards
  Wolfgang


PS: The daemon generating the web page 
       http://www.cygnus.com/ml/egcs-bugs/1999-Feb/
from this list weems to have stopped an Feb 1st. This is a pity, since it
provides a simple way of reading this list sometimes without being flooded
by its whole content. Could anyone try to restart the program?



More information about the Gcc-bugs mailing list