]> granicus.if.org Git - clang/commitdiff
Slight generalization for Evaluate with const variables.
authorEli Friedman <eli.friedman@gmail.com>
Mon, 30 Mar 2009 23:39:01 +0000 (23:39 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 30 Mar 2009 23:39:01 +0000 (23:39 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68075 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ExprConstant.cpp

index b0954e149c400f3125c46b459cee3219df95f603..645811319a4652de71082ad3793e95fdcdbd2743 100644 (file)
@@ -685,8 +685,8 @@ bool IntExprEvaluator::VisitDeclRefExpr(const DeclRefExpr *E) {
   }
 
   // In C++, const, non-volatile integers initialized with ICEs are ICEs.
-  if (Info.Ctx.getLangOptions().CPlusPlus &&
-      E->getType().getCVRQualifiers() == QualType::Const) {
+  // In C, they can also be folded, although they are not ICEs.
+  if (E->getType().getCVRQualifiers() == QualType::Const) {
     if (const VarDecl *D = dyn_cast<VarDecl>(E->getDecl())) {
       if (const Expr *Init = D->getInit())
         return Visit(const_cast<Expr*>(Init));