29 lines · cpp
1// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -debug-info-kind=limited -emit-llvm -o - | FileCheck %s2// This test is for a crash when emitting debug info for not-yet-completed3// 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: DIFlagFwdDecl7// CHECK-SAME: ){{$}}8template <class A> class Derived;9 10template <class A> class Base {11 static Derived<A> *create();12};13 14template <class A> struct Derived : Base<A> {15};16 17Base<int> *f;18 19// During the instantiation of Derived<int>, Base<int> becomes required to be20// complete - since the declaration has already been emitted (due to 'f',21// above), we immediately try to build debug info for Base<int> which then22// requires the (incomplete definition) of Derived<int> which is problematic.23//24// (if 'f' is not present, the point at which Base<int> becomes required to be25// complete during the instantiation of Derived<int> is a no-op because26// Base<int> was never emitted so we ignore it and carry on until we27// wire up the base class of Derived<int> in the debug info later on)28Derived<int> d;29