[Patch] PR11504: -Wcast-qual and general constness issues with stl_tree.h

Jonathan Wakely cow@compsoc.man.ac.uk
Fri Jul 25 12:18:00 GMT 2003


On Fri, Jul 25, 2003 at 10:10:11AM +0100, Jonathan Wakely wrote:

> On Thu, Jul 24, 2003 at 09:48:07PM +0200, Gawain Bolton wrote:
> 
> >   1. I do not like the lack of symmetry with the casts for const vs.
> >      non-const functions.
> >      Non-const versions often require a reinterpret_cast whereas const
> >      versions can use static_cast.
> 
> Can't you combine const_cast and static_cast to achieve the same thing?
> As in http://gcc.gnu.org/ml/libstdc++/2003-07/msg00297.html

[replying to myself]
hmm, no. for example _M_root() wants to return a non-const reference,
which can't be bound to the rvalue that static_cast returns.
The old parser didn't seem to mind this (or at least, versions <= 3.2)
but 3.4 won't allow it.

jon

-- 
"UNIX was not designed to stop you from doing stupid things,
 because that would also stop you from doing clever things."
	- Doug Gwyn



More information about the Libstdc++ mailing list