egcs allows deletion of const objects.
Alexandre Oliva
oliva@dcc.unicamp.br
Wed Oct 7 08:48:00 GMT 1998
Bill Currie <bcurrie@tssc.co.nz> writes:
> Hmm, now *I'm* confused. I distincly remember gcc (2.7.2.1) complaining
> about deleting a pointer with a const involved
Yep, gcc 2.7 would complain, but the C++ Standard explicitly allows it.
> To me, it just doesn't make sense being allowed to delete a constant
> object because const is meant to be a promise that the object will
> not be modified, and deleting an object definitly modifies it!
Using the same reasoning, you'd conclude that you can't construct a
const object, because you can't write into a const object. But then
you say: ok, the object becomes constant after the constructor
terminates. Then I reply: fine, and the object stops being constant
as soon as its constructor starts running, being it invoked by delete
or by some other means.
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:oliva@gnu.org mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
More information about the Gcc-bugs
mailing list