[cfe-commits] r103476 - in /cfe/trunk: lib/AST/Expr.cpp test/SemaTemplate/current-instantiation.cpp
Douglas Gregor
dgregor at apple.com
Tue May 11 09:41:27 PDT 2010
Author: dgregor
Date: Tue May 11 11:41:27 2010
New Revision: 103476
URL: http://llvm.org/viewvc/llvm-project?rev=103476&view=rev
Log:
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.
Modified:
cfe/trunk/lib/AST/Expr.cpp
cfe/trunk/test/SemaTemplate/current-instantiation.cpp
Modified: cfe/trunk/lib/AST/Expr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=103476&r1=103475&r2=103476&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Expr.cpp (original)
+++ cfe/trunk/lib/AST/Expr.cpp Tue May 11 11:41:27 2010
@@ -156,7 +156,7 @@
// (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())
Modified: cfe/trunk/test/SemaTemplate/current-instantiation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/current-instantiation.cpp?rev=103476&r1=103475&r2=103476&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/current-instantiation.cpp (original)
+++ cfe/trunk/test/SemaTemplate/current-instantiation.cpp Tue May 11 11:41:27 2010
@@ -151,3 +151,16 @@
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 };
+}
More information about the cfe-commits
mailing list