Make sure to calculate value-dependence correctly when deal with ICEs.
(Actually, this isn't precisely correct, but it doesn't make
sense to query whether an expression that isn't an ICE is
value-dependent anyway.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73179 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index da32d4e..1abd5fb 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -1177,7 +1177,12 @@
ValueDependent = true;
// - a constant with integral or enumeration type and is
// initialized with an expression that is value-dependent
- // (FIXME!).
+ else if (const VarDecl *Dcl = dyn_cast<VarDecl>(VD)) {
+ if (Dcl->getType().getCVRQualifiers() == QualType::Const &&
+ Dcl->getInit()) {
+ ValueDependent = Dcl->getInit()->isValueDependent();
+ }
+ }
}
return Owned(BuildDeclRefExpr(VD, VD->getType().getNonReferenceType(), Loc,