зеркало из https://github.com/microsoft/clang-1.git
When instantiating a function declaration within a function template,
be sure to merge its parameter scope with its parent's scope. Fixes PR7184. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104386 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
d3573f0932
Коммит
b212d9a8e1
|
@ -970,6 +970,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D,
|
|||
isFriend = (D->getFriendObjectKind() != Decl::FOK_None);
|
||||
|
||||
bool MergeWithParentScope = (TemplateParams != 0) ||
|
||||
Owner->isFunctionOrMethod() ||
|
||||
!(isa<Decl>(Owner) &&
|
||||
cast<Decl>(Owner)->isDefinedOutsideFunctionOrMethod());
|
||||
Sema::LocalInstantiationScope Scope(SemaRef, MergeWithParentScope);
|
||||
|
|
|
@ -10,3 +10,13 @@ void f() {
|
|||
S<int> s1;
|
||||
S<int> s2(10);
|
||||
}
|
||||
|
||||
namespace PR7184 {
|
||||
template<typename T>
|
||||
void f() {
|
||||
typedef T type;
|
||||
void g(int array[sizeof(type)]);
|
||||
}
|
||||
|
||||
template void f<int>();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче