diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2009-03-30 23:39:01 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2009-03-30 23:39:01 +0000 |
commit | e1646da3bb0fe97b372e5fe8cefc537b22048fc4 (patch) | |
tree | 7c4d737d8b24dff20ad7d5255219b0aa8592c329 /lib/AST/ExprConstant.cpp | |
parent | 7532dc66648cfe7432c9fe66dec5225f0ab301c6 (diff) |
Slight generalization for Evaluate with const variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68075 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index b0954e149c..645811319a 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -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)); |