mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-29 03:26:06 +00:00
When instantiating a variable without an initializer, call
ActOnUninitializedDecl. llvm-svn: 77211
This commit is contained in:
parent
e48c85fa8b
commit
d612997e73
@ -146,9 +146,8 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
|
||||
else
|
||||
SemaRef.AddInitializerToDecl(Sema::DeclPtrTy::make(Var), move(Init),
|
||||
D->hasCXXDirectInitializer());
|
||||
} else {
|
||||
// FIXME: Call ActOnUninitializedDecl? (Not always)
|
||||
}
|
||||
} else if (!Var->isStaticDataMember() || Var->isOutOfLine())
|
||||
SemaRef.ActOnUninitializedDecl(Sema::DeclPtrTy::make(Var), false);
|
||||
|
||||
// Link instantiations of static data members back to the template from
|
||||
// which they were instantiated.
|
||||
|
@ -16,3 +16,25 @@ class Y {
|
||||
};
|
||||
|
||||
Y<float> fy; // expected-note{{in instantiation of template class 'class Y<float>' requested here}}
|
||||
|
||||
|
||||
// out-of-line static member variables
|
||||
|
||||
template<typename T>
|
||||
struct Z {
|
||||
static T value;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
T Z<T>::value; // expected-error{{no matching constructor}}
|
||||
|
||||
struct DefCon {};
|
||||
|
||||
struct NoDefCon {
|
||||
NoDefCon(const NoDefCon&);
|
||||
};
|
||||
|
||||
void test() {
|
||||
DefCon &DC = Z<DefCon>::value;
|
||||
NoDefCon &NDC = Z<NoDefCon>::value; // expected-note{{instantiation}}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user