diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-03-11 23:27:41 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-03-11 23:27:41 +0000 |
commit | 5ecbb1bc24f1945c97661308bdab8b47ea267017 (patch) | |
tree | fe77f6950072f8a20d355636fd207102598e1dc5 /clang | |
parent | b7c6e8f5752d727f725406d2611964fe2dd86fae (diff) | |
download | bcm5719-llvm-5ecbb1bc24f1945c97661308bdab8b47ea267017.tar.gz bcm5719-llvm-5ecbb1bc24f1945c97661308bdab8b47ea267017.zip |
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
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 3 | ||||
-rw-r--r-- | clang/test/SemaTemplate/nested-name-spec-template.cpp | 13 |
2 files changed, 15 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 23329a3ab6c..ec1cf6c556e 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -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(), diff --git a/clang/test/SemaTemplate/nested-name-spec-template.cpp b/clang/test/SemaTemplate/nested-name-spec-template.cpp index 7730ee395f4..635687d4f6b 100644 --- a/clang/test/SemaTemplate/nested-name-spec-template.cpp +++ b/clang/test/SemaTemplate/nested-name-spec-template.cpp @@ -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}} +} |