members of class templates so that their values can be used in ICEs. This
required reverting r105465, to get such instantiated members to be included in
serialized ASTs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147023
91177308-0d34-0410-b5e6-
96231b3b80d8
// This is a modification of an existing AST node. Notify listeners.
if (ASTMutationListener *L = getASTMutationListener())
L->StaticDataMemberInstantiated(Var);
- PendingInstantiations.push_back(std::make_pair(Var, Loc));
+ QualType T = Var->getType();
+ if (T.isConstQualified() && !T.isVolatileQualified() &&
+ T->isIntegralOrEnumerationType())
+ InstantiateStaticDataMemberDefinition(Loc, Var);
+ else
+ PendingInstantiations.push_back(std::make_pair(Var, Loc));
}
}
SemaRef.CheckVariableDeclaration(Var, Previous);
if (D->isOutOfLine()) {
- if (!D->isStaticDataMember())
- D->getLexicalDeclContext()->addDecl(Var);
+ D->getLexicalDeclContext()->addDecl(Var);
Owner->makeDeclVisibleInContext(Var);
} else {
Owner->addDecl(Var);
template <typename T>
struct TS3 {
static const int value = 0;
+ static const int value2;
};
template <typename T>
const int TS3<T>::value;
+template <typename T>
+const int TS3<T>::value2 = 1;
// Instantiate struct, but not value.
struct instantiate : TS3<int> {};
struct A { };
struct B : A { };
-// Instantiate TS3's member.
+// Instantiate TS3's members.
static const int ts3m1 = TS3<int>::value;
+extern int arr[TS3<int>::value2];
// Redefinition of typedef
typedef int Integer;
// Should have remembered that there is a definition.
static const int ts3m2 = TS3<int>::value;
+int arr[TS3<int>::value2];
//===----------------------------------------------------------------------===//
#endif
template<typename T>
const unsigned X1<T>::value = sizeof(T);
-int array3[X1<int>::value == sizeof(int)? 1 : -1]; // expected-error{{variable length array declaration not allowed at file scope}}
+int array3[X1<int>::value == sizeof(int)? 1 : -1];