[cfe-commits] Better const_cast support

Sebastian Redl sebastian.redl at getdesigned.at
Fri Sep 26 13:33:50 PDT 2008

Eli Friedman wrote:
> On Fri, Sep 26, 2008 at 12:27 PM, Sebastian Redl
> <sebastian.redl at getdesigned.at> wrote:
>> Not really. The standard is pretty clear on this: no pointer to function, no
>> matter how many levels of indirection, is allowed in a const_cast.
> Take the following code:
> typedef int f(int);
> f func;
> f*const fp = func;
> f** fpp = const_cast<f**>(&fp);
> f*const* is a pointer to a const-qualified object type, and f** is a
> pointer to the corresponding non-const-qualified type.
True, I forgot that pointers are objects, too. OK, that makes it a bit 
trickier, but not by much.
> Oh, and try to remember to use "Reply to all" when you're writing
> responses on this mailing list; reply-to defaults to the sender, not
> the list.
The hard part is knowing which of the mailing lists I use work which way.


More information about the cfe-commits mailing list