[cfe-commits] Better const_cast support

Sebastian Redl sebastian.redl at getdesigned.at
Sat Sep 27 03:47:09 PDT 2008


Eli Friedman wrote:
> On Fri, Sep 26, 2008 at 3:10 PM, Sebastian Redl
> <sebastian.redl at getdesigned.at> wrote:
>   
>> What it does not support is array decay. This fails:
>>
>> const int ar[100];
>> int *pi = const_cast<int*>(ar);
>>
>> This is because lvalue-to-rvalue conversion is not performed on the argument
>> (would lead to array decay). Is a generic facility for this in the semantic
>> checker somewhere? It's really indispensable for C++ semantic checking.
>>     
>
> Sema::DefaultFunctionArrayConversion should do what you want in the
> cases where the destination type isn't a reference type.
>
> -Eli
>   

Thank you. Now the array decay line is correctly supported and no longer 
fails. I think this patch is therefore complete.

Sebastian
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: const_cast.patch
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20080927/416dcb60/attachment.ksh>


More information about the cfe-commits mailing list