Static data members intialized in-class that have constant values are

value-dependent if their initializers are value-dependent; my recent
tweak to these dependent rules overstepped by taking away this
value-dependents. Fixes a Boost.GIL regression.

llvm-svn: 103476
This commit is contained in:
Douglas Gregor 2010-05-11 16:41:27 +00:00
parent 2d2623c710
commit 112de35e5b
2 changed files with 14 additions and 1 deletions

View File

@ -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())

View File

@ -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 };
}