This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: C++ front end ignores constness in sometimes
- To: Wolfgang Bangerth <wolf at gaia dot IWR dot Uni-Heidelberg dot De>
- Subject: Re: C++ front end ignores constness in sometimes
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 24 Feb 1999 07:29:56 -0300
- Cc: egcs-bugs at cygnus dot com
- References: <Pine.SOL.4.05.9902241044190.1908-100000@tethys>
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