Fix assert when instantiating a default argument of a template defined in a

module.

llvm-svn: 187556
This commit is contained in:
Richard Smith 2013-08-01 04:12:04 +00:00
parent 302ae6b002
commit b71782b7e5
3 changed files with 9 additions and 1 deletions

View File

@ -1959,7 +1959,10 @@ TemplateSpecializationKind VarDecl::getTemplateSpecializationKind() const {
}
MemberSpecializationInfo *VarDecl::getMemberSpecializationInfo() const {
return getASTContext().getInstantiatedFromStaticDataMember(this);
if (isStaticDataMember())
return getASTContext().getInstantiatedFromStaticDataMember(this);
return 0;
}
void VarDecl::setTemplateSpecializationKind(TemplateSpecializationKind TSK,

View File

@ -20,3 +20,5 @@ template<typename T> void PerformDelayedLookup(T &t) {
typename T::Inner inner;
FoundByADL(t);
}
template<typename T> void PerformDelayedLookupInDefaultArgument(T &t, int a = (FoundByADL(T()), 0)) {}

View File

@ -51,6 +51,9 @@ void g() {
// 'common'. That type is not visible here.
PerformDelayedLookup(defined_in_common);
// Likewise, but via a default argument.
PerformDelayedLookupInDefaultArgument(defined_in_common);
// Trigger the instantiation of a template in 'b' that uses a type defined in
// 'b_impl'. That type is not visible here.
UseDefinedInBImpl<int>();