diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 5fd38f71ed20..7995def33224 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -39,6 +39,8 @@ namespace { // FIXME: Once we get closer to completion, replace these // manually-written declarations with automatically-generated ones // from clang/AST/DeclNodes.def. + Decl *VisitTranslationUnitDecl(TranslationUnitDecl *D); + Decl *VisitNamespaceDecl(NamespaceDecl *D); Decl *VisitTypedefDecl(TypedefDecl *D); Decl *VisitFieldDecl(FieldDecl *D); Decl *VisitStaticAssertDecl(StaticAssertDecl *D); @@ -63,6 +65,18 @@ namespace { }; } +Decl * +TemplateDeclInstantiator::VisitTranslationUnitDecl(TranslationUnitDecl *D) { + assert(false && "Translation units cannot be instantiated"); + return D; +} + +Decl * +TemplateDeclInstantiator::VisitNamespaceDecl(NamespaceDecl *D) { + assert(false && "Namespaces cannot be instantiated"); + return D; +} + Decl *TemplateDeclInstantiator::VisitTypedefDecl(TypedefDecl *D) { bool Invalid = false; QualType T = D->getUnderlyingType();