[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 10:44:23 PDT 2009


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.


Modified:
    cfe/trunk/lib/AST/Expr.cpp
    cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp

Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=81453&r1=81452&r2=81453&view=diff

==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Thu Sep 10 12:44:23 2009
@@ -1464,7 +1464,10 @@
   }
   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);

Modified: cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp?rev=81453&r1=81452&r2=81453&view=diff

==============================================================================
--- cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp (original)
+++ cfe/trunk/test/SemaCXX/i-c-e-cxx.cpp Thu Sep 10 12:44:23 2009
@@ -4,3 +4,7 @@
 
 const int c = 10;
 int ar[c];
+
+struct X0 {
+  static const int value = static_cast<int>(4.0);
+};





More information about the cfe-commits mailing list