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]

Re: C++ front end ignores constness in sometimes


On Feb 24, 1999, Wolfgang Bangerth <wolf@gaia.IWR.Uni-Heidelberg.De> wrote:

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

There's no constness violation here; egcs is correct WRT to C++ Standard.

> class Y { public: void f(const int); };
> void Y::f(int x) { x = 1; };

top-level cv-qualifiers are discarded from (member-)function
signatures, they're only significant within the function body.
However, in the function definition, x is not const, so it can be
changed.

Thanks for your report anyway.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva aoliva@{acm.org,computer.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Instituto de Computação, Universidade Estadual de Campinas, SP, Brasil



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