aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-09-16 18:34:49 +0000
committerDouglas Gregor <dgregor@apple.com>2009-09-16 18:34:49 +0000
commite95b40961302c2130968ddfc3ba162e138f2118e (patch)
treeae9af375b0a6cb7bf1a16b555508307537f8fda4 /lib/Sema/SemaTemplateInstantiate.cpp
parent59a53fa3f8ea73bae52ea36d0038f76e9f10729c (diff)
Teach Sema::FindInstantiatedDecl to find instantiated RecordDecls even
when we are not instantiating the corresponding "current instantiation." This happens, e.g., when we are instantiating a declaration reference that refers into the "current instantiation" but occurs in a default function argument. The libstdc++ vector default constructor now instantiates properly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82069 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 87216a072d..86b49d4f32 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -429,7 +429,7 @@ Decl *TemplateInstantiator::TransformDecl(Decl *D) {
"Reducing depth of template template parameters is not yet implemented");
}
- return SemaRef.FindInstantiatedDecl(cast<NamedDecl>(D));
+ return SemaRef.FindInstantiatedDecl(cast<NamedDecl>(D), TemplateArgs);
}
Decl *TemplateInstantiator::TransformDefinition(Decl *D) {
@@ -533,7 +533,8 @@ TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E) {
if (Arg.getKind() == TemplateArgument::Declaration) {
ValueDecl *VD = cast<ValueDecl>(Arg.getAsDecl());
- VD = cast_or_null<ValueDecl>(getSema().FindInstantiatedDecl(VD));
+ VD = cast_or_null<ValueDecl>(
+ getSema().FindInstantiatedDecl(VD, TemplateArgs));
if (!VD)
return SemaRef.ExprError();
@@ -562,7 +563,7 @@ TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E) {
E->getSourceRange().getBegin()));
}
- NamedDecl *InstD = SemaRef.FindInstantiatedDecl(D);
+ NamedDecl *InstD = SemaRef.FindInstantiatedDecl(D, TemplateArgs);
if (!InstD)
return SemaRef.ExprError();