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.

llvm-svn: 81453
This commit is contained in:
Douglas Gregor 2009-09-10 17:44:23 +00:00
parent d5107d1333
commit 7736e2ad98
2 changed files with 8 additions and 1 deletions

View File

@ -1464,7 +1464,10 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
}
case Expr::ImplicitCastExprClass:
case Expr::CStyleCastExprClass:
case Expr::CXXFunctionalCastExprClass: {
case Expr::CXXFunctionalCastExprClass:
case Expr::CXXStaticCastExprClass:
case Expr::CXXReinterpretCastExprClass:
case Expr::CXXConstCastExprClass: {
const Expr *SubExpr = cast<CastExpr>(E)->getSubExpr();
if (SubExpr->getType()->isIntegralType())
return CheckICE(SubExpr, Ctx);

View File

@ -4,3 +4,7 @@
const int c = 10;
int ar[c];
struct X0 {
static const int value = static_cast<int>(4.0);
};