forked from OSchip/llvm-project
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:
parent
d5107d1333
commit
7736e2ad98
|
@ -1464,7 +1464,10 @@ static ICEDiag CheckICE(const Expr* E, ASTContext &Ctx) {
|
||||||
}
|
}
|
||||||
case Expr::ImplicitCastExprClass:
|
case Expr::ImplicitCastExprClass:
|
||||||
case Expr::CStyleCastExprClass:
|
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();
|
const Expr *SubExpr = cast<CastExpr>(E)->getSubExpr();
|
||||||
if (SubExpr->getType()->isIntegralType())
|
if (SubExpr->getType()->isIntegralType())
|
||||||
return CheckICE(SubExpr, Ctx);
|
return CheckICE(SubExpr, Ctx);
|
||||||
|
|
|
@ -4,3 +4,7 @@
|
||||||
|
|
||||||
const int c = 10;
|
const int c = 10;
|
||||||
int ar[c];
|
int ar[c];
|
||||||
|
|
||||||
|
struct X0 {
|
||||||
|
static const int value = static_cast<int>(4.0);
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue