diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-03-01 15:56:25 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-03-01 15:56:25 +0000 |
commit | 7c1e98f1cb37b40e619a0c8aee8b337f037b432b (patch) | |
tree | 56f3f26745abd29e628de2af46d1bf9adb492be8 /lib/Sema/SemaTemplateInstantiate.cpp | |
parent | 14d2328ecfc5102b077fa2c2c129dce1574c8831 (diff) |
When looking for the instantiated declaration that corresponds to a
given declaration in a template, make sure that the context we're
searching through is complete. Fixes PR6376.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97444 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index f12c559ec1..fbd1a9ff1a 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -540,7 +540,7 @@ namespace { /// \brief Transform the given declaration by instantiating a reference to /// this declaration. - Decl *TransformDecl(Decl *D); + Decl *TransformDecl(SourceLocation Loc, Decl *D); /// \brief Transform the definition of the given declaration by /// instantiating it. @@ -575,7 +575,7 @@ namespace { }; } -Decl *TemplateInstantiator::TransformDecl(Decl *D) { +Decl *TemplateInstantiator::TransformDecl(SourceLocation Loc, Decl *D) { if (!D) return 0; @@ -600,7 +600,7 @@ Decl *TemplateInstantiator::TransformDecl(Decl *D) { // template parameter. } - return SemaRef.FindInstantiatedDecl(cast<NamedDecl>(D), TemplateArgs); + return SemaRef.FindInstantiatedDecl(Loc, cast<NamedDecl>(D), TemplateArgs); } Decl *TemplateInstantiator::TransformDefinition(Decl *D) { @@ -623,7 +623,7 @@ TemplateInstantiator::TransformFirstQualifierInScope(NamedDecl *D, if (TTP->getDepth() < TemplateArgs.getNumLevels()) { QualType T = TemplateArgs(TTP->getDepth(), TTP->getIndex()).getAsType(); if (T.isNull()) - return cast_or_null<NamedDecl>(TransformDecl(D)); + return cast_or_null<NamedDecl>(TransformDecl(Loc, D)); if (const TagType *Tag = T->getAs<TagType>()) return Tag->getDecl(); @@ -634,7 +634,7 @@ TemplateInstantiator::TransformFirstQualifierInScope(NamedDecl *D, } } - return cast_or_null<NamedDecl>(TransformDecl(D)); + return cast_or_null<NamedDecl>(TransformDecl(Loc, D)); } VarDecl * @@ -724,7 +724,8 @@ TemplateInstantiator::TransformTemplateParmRefExpr(DeclRefExpr *E, // Find the instantiation of the template argument. This is // required for nested templates. VD = cast_or_null<ValueDecl>( - getSema().FindInstantiatedDecl(VD, TemplateArgs)); + getSema().FindInstantiatedDecl(E->getLocation(), + VD, TemplateArgs)); if (!VD) return SemaRef.ExprError(); |