Don't ask if a depenendent CXXRecordDecl has any dependent bases

unless we already know that it has a definition. Fixes
PR9449/<rdar://problem/9115785>.

llvm-svn: 127512
This commit is contained in:
Douglas Gregor 2011-03-11 23:27:41 +00:00
parent b7c6e8f575
commit 5ecbb1bc24
2 changed files with 15 additions and 1 deletions

View File

@ -2036,7 +2036,8 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S,
MemberOfUnknownSpecialization);
if (TNK == TNK_Non_template && LookupCtx->isDependentContext() &&
isa<CXXRecordDecl>(LookupCtx) &&
cast<CXXRecordDecl>(LookupCtx)->hasAnyDependentBases()) {
(!cast<CXXRecordDecl>(LookupCtx)->hasDefinition() ||
cast<CXXRecordDecl>(LookupCtx)->hasAnyDependentBases())) {
// This is a dependent template. Handle it below.
} else if (TNK == TNK_Non_template) {
Diag(Name.getSourceRange().getBegin(),

View File

@ -127,3 +127,16 @@ namespace PR9226 {
Y<X, int> yxi; // expected-note{{in instantiation of template class 'PR9226::Y<PR9226::X, int>' requested here}}
}
namespace PR9449 {
template <typename T>
struct s; // expected-note{{template is declared here}}
template <typename T>
void f() {
int s<T>::template n<T>::* f; // expected-error{{implicit instantiation of undefined template 'PR9449::s<int>'}} \
// expected-error{{following the 'template' keyword}}
}
template void f<int>(); // expected-note{{in instantiation of}}
}