Add using shadow decls to the "instantiated locals" map, fixing PR5847.

llvm-svn: 91928
This commit is contained in:
John McCall 2009-12-22 22:26:37 +00:00
parent b6ea60872d
commit a1d8550778
2 changed files with 19 additions and 0 deletions

View File

@ -1161,6 +1161,8 @@ Decl *TemplateDeclInstantiator::VisitUsingDecl(UsingDecl *D) {
if (NewUD->isInvalidDecl())
return NewUD;
bool isFunctionScope = Owner->isFunctionOrMethod();
// Process the shadow decls.
for (UsingDecl::shadow_iterator I = D->shadow_begin(), E = D->shadow_end();
I != E; ++I) {
@ -1176,6 +1178,9 @@ Decl *TemplateDeclInstantiator::VisitUsingDecl(UsingDecl *D) {
UsingShadowDecl *InstShadow
= SemaRef.BuildUsingShadowDecl(/*Scope*/ 0, NewUD, InstTarget);
SemaRef.Context.setInstantiatedFromUsingShadowDecl(InstShadow, Shadow);
if (isFunctionScope)
SemaRef.CurrentInstantiationScope->InstantiatedLocal(Shadow, InstShadow);
}
return NewUD;

View File

@ -47,3 +47,17 @@ namespace test1 {
Knot().Visit((struct Object3*) 0); // expected-error {{no matching member function for call}}
}
}
// PR5847
namespace test2 {
namespace ns {
void foo();
}
template <class T> void bar(T* ptr) {
using ns::foo;
foo();
}
template void bar(char *);
}