diff options
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 2 | ||||
-rw-r--r-- | lib/Sema/SemaTemplateInstantiateDecl.cpp | 6 | ||||
-rw-r--r-- | test/SemaTemplate/instantiate-declref.cpp | 16 |
3 files changed, 13 insertions, 11 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 8bd753abea..abae9f04cc 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -2701,7 +2701,7 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl) { if (const ArrayType *Array = Context.getAsArrayType(Type)) InitType = Array->getElementType(); if ((!Var->hasExternalStorage() && !Var->isExternC(Context)) && - InitType->isRecordType()) { + InitType->isRecordType() && !InitType->isDependentType()) { CXXRecordDecl *RD = cast<CXXRecordDecl>(InitType->getAsRecordType()->getDecl()); CXXConstructorDecl *Constructor = 0; diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 39e455a6ec..ef351f0954 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -97,8 +97,6 @@ Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) { Typedef->setInvalidDecl(); Owner->addDecl(SemaRef.Context, Typedef); - if (Owner->isFunctionOrMethod()) - SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Typedef); return Typedef; } @@ -214,8 +212,6 @@ Decl *TemplateDeclInstantiator::VisitEnumDecl(EnumDecl *D) { Enum->setInstantiationOfMemberEnum(D); Enum->setAccess(D->getAccess()); Owner->addDecl(SemaRef.Context, Enum); - if (Owner->isFunctionOrMethod()) - SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Enum); Enum->startDefinition(); llvm::SmallVector<Sema::DeclPtrTy, 16> Enumerators; @@ -281,8 +277,6 @@ Decl *TemplateDeclInstantiator::VisitCXXRecordDecl(CXXRecordDecl *D) { Record->setInstantiationOfMemberClass(D); Owner->addDecl(SemaRef.Context, Record); - if (Owner->isFunctionOrMethod()) - SemaRef.CurrentInstantiationScope->InstantiatedLocal(D, Record); return Record; } diff --git a/test/SemaTemplate/instantiate-declref.cpp b/test/SemaTemplate/instantiate-declref.cpp index e49d330f63..590f241f2f 100644 --- a/test/SemaTemplate/instantiate-declref.cpp +++ b/test/SemaTemplate/instantiate-declref.cpp @@ -40,13 +40,20 @@ template struct N::Outer::Inner::InnerTemplate<INT>::UeberInner; // expected-err namespace N2 { struct Outer2 { - template<typename T> + template<typename T, typename U = T> struct Inner { void foo() { enum { K1Val = sizeof(T) } k1; - enum K2 { K2Val = sizeof(T)*2 }; + enum K2 { K2Val = sizeof(T)*2 } k2a; - K2 k2 = K2Val; + K2 k2b = K2Val; + + struct S { T x, y; } s1; + struct { U x, y; } s2; + s1.x = s2.x; // expected-error{{incompatible}} + + typedef T type; + type t2 = s1.x; Inner i1; i1.foo(); @@ -57,4 +64,5 @@ namespace N2 { }; } -// FIXME: template struct N2::Outer2::Inner<float>; +template struct N2::Outer2::Inner<float>; +template struct N2::Outer2::Inner<int*, float*>; // expected-note{{instantiation}} |