From e8dbe3f862b764015d233c4030be6d668242c340 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 17 Jun 2019 19:40:52 +0000 Subject: [PATCH] PR42205: DebugInfio: Do not attempt to emit debug info metadata for static member variable template partial specializations Would cause a crash in an attempt to create the type for the still unresolved 'auto' in the partial specialization (& even without the use of 'auto', the expression would be value dependent & crash/assertion-fail there). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363606 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 3 +++ .../debug-info-var-template-partial-spec.cpp | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 test/CodeGenCXX/debug-info-var-template-partial-spec.cpp diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index af9bac9b38..a53ca8f524 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/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/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp b/test/CodeGenCXX/debug-info-var-template-partial-spec.cpp new file mode 100644 index 0000000000..675e328237 --- /dev/null +++ b/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; -- 2.40.0