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 | // rdar://problem/15931354 |
9 | template <class A> class Derived; |
10 | |
11 | template <class A> class Base { |
12 | static Derived<A> *create(); |
13 | }; |
14 | |
15 | template <class A> struct Derived : Base<A> { |
16 | }; |
17 | |
18 | Base<int> *f; |
19 | |
20 | // During the instantiation of Derived<int>, Base<int> becomes required to be |
21 | // complete - since the declaration has already been emitted (due to 'f', |
22 | // above), we immediately try to build debug info for Base<int> which then |
23 | // requires the (incomplete definition) of Derived<int> which is problematic. |
24 | // |
25 | // (if 'f' is not present, the point at which Base<int> becomes required to be |
26 | // complete during the instantiation of Derived<int> is a no-op because |
27 | // Base<int> was never emitted so we ignore it and carry on until we |
28 | // wire up the base class of Derived<int> in the debug info later on) |
29 | Derived<int> d; |
30 | |