зеркало из https://github.com/microsoft/clang-1.git
Link up member-class redeclarations during template instantiation.
This test courtesy of LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91462 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
80737ad5e0
Коммит
6c1c1b8c6c
|
@ -645,6 +645,12 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) {
|
|||
CXXRecordDecl *PrevDecl = 0;
|
||||
if (D->isInjectedClassName())
|
||||
PrevDecl = cast<CXXRecordDecl>(Owner);
|
||||
else if (D->getPreviousDeclaration()) {
|
||||
NamedDecl *Prev = SemaRef.FindInstantiatedDecl(D->getPreviousDeclaration(),
|
||||
TemplateArgs);
|
||||
if (!Prev) return 0;
|
||||
PrevDecl = cast<CXXRecordDecl>(Prev);
|
||||
}
|
||||
|
||||
CXXRecordDecl *Record
|
||||
= CXXRecordDecl::Create(SemaRef.Context, D->getTagKind(), Owner,
|
||||
|
|
|
@ -36,3 +36,17 @@ void test_instantiation(X<double>::C *x,
|
|||
X<void>::C *c3; // okay
|
||||
X<void>::D::E *e1; // okay
|
||||
X<void>::D::E e2; // expected-note{{in instantiation of member class 'struct X<void>::D::E' requested here}}
|
||||
|
||||
// Redeclarations.
|
||||
namespace test1 {
|
||||
template <typename T> struct Registry {
|
||||
class node;
|
||||
static node *Head;
|
||||
class node {
|
||||
node(int v) { Head = this; }
|
||||
};
|
||||
};
|
||||
void test() {
|
||||
Registry<int>::node node(0);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче