[cfe-commits] Better const_cast support

Sebastian Redl sebastian.redl at getdesigned.at
Fri Sep 26 15:10:32 PDT 2008


Updated patch. Supports arrays and function pointers the same way as GCC 
(as near as I can determine).

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.

The test case will now fail because I've put the above in it. I think 
it's better to have a failing test than to know there's a missing 
feature but eventually forget about it.

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/e90dd03e/attachment.ksh>


More information about the cfe-commits mailing list