Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / debug-info-template-fwd.cpp
blobb6c6aa15fde672dd6fc5fd88499502d788ad41f5
1 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -debug-info-kind=limited -emit-llvm -o - | FileCheck %s
2 // This test is for a crash when emitting debug info for not-yet-completed
3 // types.
4 // Test that we don't actually emit a forward decl for the offending class:
5 // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Derived<int>"
6 // CHECK-NOT: DIFlagFwdDecl
7 // CHECK-SAME: ){{$}}
8 template <class A> class Derived;
10 template <class A> class Base {
11 static Derived<A> *create();
14 template <class A> struct Derived : Base<A> {
17 Base<int> *f;
19 // During the instantiation of Derived<int>, Base<int> becomes required to be
20 // complete - since the declaration has already been emitted (due to 'f',
21 // above), we immediately try to build debug info for Base<int> which then
22 // requires the (incomplete definition) of Derived<int> which is problematic.
24 // (if 'f' is not present, the point at which Base<int> becomes required to be
25 // complete during the instantiation of Derived<int> is a no-op because
26 // Base<int> was never emitted so we ignore it and carry on until we
27 // wire up the base class of Derived<int> in the debug info later on)
28 Derived<int> d;