diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-09-10 17:44:23 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-09-10 17:44:23 +0000 |
commit | 59600d80b7e34e819cd25dd67f661aa1f3d9099d (patch) | |
tree | 04a21648107a2e0fdd65092187529722b11d8823 | |
parent | e942bbe02b6fb332d1f13d38c6e1980b416cf89a (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81453 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/Expr.cpp | 5 | ||||
-rw-r--r-- | test/SemaCXX/i-c-e-cxx.cpp | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index a90b9984d4..2e2f35957c 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -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); diff --git a/test/SemaCXX/i-c-e-cxx.cpp b/test/SemaCXX/i-c-e-cxx.cpp index 32d04e2da4..dc369aba2d 100644 --- a/test/SemaCXX/i-c-e-cxx.cpp +++ b/test/SemaCXX/i-c-e-cxx.cpp @@ -4,3 +4,7 @@ const int c = 10; int ar[c]; + +struct X0 { + static const int value = static_cast<int>(4.0); +}; |