[cfe-commits] r81453 - in /cfe/trunk: lib/AST/Expr.cpp test/SemaCXX/i-c-e-cxx.cpp

Douglas Gregor dgregor at apple.com
Thu Sep 10 15:29:39 PDT 2009


On Sep 10, 2009, at 1:12 PM, Chris Lattner wrote:

>
> On Sep 10, 2009, at 10:44 AM, Douglas Gregor wrote:
>
>> Author: dgregor
>> Date: Thu Sep 10 12:44:23 2009
>> New Revision: 81453
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=81453&view=rev
>> Log:
>> static_cast, reinterpret_cast, and const_cast can all be used in C++
>> integral constant expressions (for conversions to integer types,
>> naturally). I don't *think* that const_casts will ever get to this
>> point, but I also can't convince myself that they won't... so I've
>> taken the safe route and allowed the ICE checking code to look at
>> const_cast.
>
> How about just making it assert out if const_cast is seen here?   
> That way you'd know if it happens.


Well (a) the assert is messy to write, requiring me to restructure  
that bit of code, (b) I only expect that this would happen in  
completely insane code where we're unlikely to have a +Asserts build  
of Clang anyway, and (c) the safe option I've already implemented has  
only a tiny down-side of needing to look at the SubExpr and type of  
the const_cast rather than returning immediately.

	- Doug



More information about the cfe-commits mailing list