Index: clang/lib/Sema/SemaTemplateInstantiate.cpp =================================================================== --- clang/lib/Sema/SemaTemplateInstantiate.cpp +++ clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2846,8 +2846,6 @@ SavedContext.pop(); if (!Instantiation->isInvalidDecl()) { - Consumer.HandleTagDeclDefinition(Instantiation); - // Always emit the vtable for an explicit instantiation definition // of a polymorphic class template specialization. Otherwise, eagerly // instantiate only constexpr virtual functions in preparation for their use @@ -2859,6 +2857,8 @@ /*ConstexprOnly*/ true); } + Consumer.HandleTagDeclDefinition(Instantiation); + return Instantiation->isInvalidDecl(); }