diff options
-rw-r--r-- | lib/AST/Expr.cpp | 2 | ||||
-rw-r--r-- | test/SemaTemplate/current-instantiation.cpp | 13 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 4b45935b3e..4a616719cc 100644 --- a/lib/AST/Expr.cpp +++ b/lib/AST/Expr.cpp @@ -156,7 +156,7 @@ void DeclRefExpr::computeDependence() { // (VD) - a constant with integral or enumeration type and is // initialized with an expression that is value-dependent. else if (VarDecl *Var = dyn_cast<VarDecl>(D)) { - if (Var->getType()->isIntegralType() && !Var->isStaticDataMember() && + if (Var->getType()->isIntegralType() && Var->getType().getCVRQualifiers() == Qualifiers::Const) { if (const Expr *Init = Var->getAnyInitializer()) if (Init->isValueDependent()) diff --git a/test/SemaTemplate/current-instantiation.cpp b/test/SemaTemplate/current-instantiation.cpp index 45637484f0..c631dd71d1 100644 --- a/test/SemaTemplate/current-instantiation.cpp +++ b/test/SemaTemplate/current-instantiation.cpp @@ -151,3 +151,16 @@ struct X1 { X1<T*>::a = b; } }; + +namespace ConstantInCurrentInstantiation { + template<typename T> + struct X { + static const int value = 2; + static int array[value]; + }; + + template<typename T> const int X<T>::value; + + template<typename T> + int X<T>::array[X<T>::value] = { 1, 2 }; +} |