diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index af9bac9b388f..a53ca8f5243c 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -1410,6 +1410,9 @@ void CGDebugInfo::CollectRecordFields( isa(V)) continue; + if (isa(V)) + continue; + // Reuse the existing static member declaration if one exists auto MI = StaticDataMemberCache.find(V->getCanonicalDecl()); if (MI != StaticDataMemberCache.end()) { diff --git a/clang/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp b/clang/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp new file mode 100644 index 000000000000..675e32823718 --- /dev/null +++ b/clang/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 %s -std=c++14 -debug-info-kind=limited -emit-llvm -o - | FileCheck %s + +// CHECK: ![[empty:[0-9]+]] = !{} + +// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "B", +// CHECK-SAME: elements: ![[empty]] + +struct B { + template + static const int d = 0; + template + static const auto d = d; +} c;