[cfe-dev] Preliminary reinterpret_cast Sema patch

Sebastian Redl sebastian.redl at getdesigned.at
Thu Oct 23 14:06:07 PDT 2008


Doug Gregor wrote:
> On Thu, Oct 23, 2008 at 4:59 AM, Sebastian Redl
> <sebastian.redl at getdesigned.at> wrote:
>   
>> I'll just post another full version of the patch. With SVN, separating
>> different parts is always a bit of a hassle.
>>     
>
> Yes, it is. Looking forward to your next revision!
>   
Here you go. I split the check for casting away constness in its own 
function, since it will be needed for static and dynamic casts as well. 
Both const cast checker and the constness helper now use 
UnwrapSimilarPointers for the loop.

I integrated the test cases into the source tree, and added one for the 
edge case of casting away constness, i.e. that adding const at every 
level should work. There's probably even more complicated tests 
involving volatile that should be tested, but my mind refuses to handle 
more than two levels of pointers with qualifiers properly. ;-)

There's also a test case for the pedantic warning.


Now, with all your nice work on conversions, static_cast checking should 
be possible without too much effort.

Sebastian
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cxx_cast.patch
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20081023/259df0c5/attachment.ksh>


More information about the cfe-dev mailing list