diff options
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 3 | ||||
-rw-r--r-- | clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 87bd955a6c0..25aaa30855b 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -3283,7 +3283,8 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) { case Decl::ClassTemplateSpecialization: { const auto *Spec = cast<ClassTemplateSpecializationDecl>(D); if (DebugInfo && - Spec->getSpecializationKind() == TSK_ExplicitInstantiationDefinition) + Spec->getSpecializationKind() == TSK_ExplicitInstantiationDefinition && + Spec->hasDefinition()) DebugInfo->completeTemplateDefinition(*Spec); break; } diff --git a/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp b/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp index 506c0d53575..461303884b8 100644 --- a/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp +++ b/clang/test/CodeGenCXX/debug-info-template-explicit-specialization.cpp @@ -91,3 +91,11 @@ struct j { extern template class j<int>; j<int> jj; // CHECK: ; [ DW_TAG_structure_type ] [j<int, int>] + +template <typename T> +struct k { +}; +template <> +struct k<int>; +template struct k<int>; +// CHECK-NOT: ; [ DW_TAG_structure_type ] [k<int>] |