// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin -debug-info-kind=limited -emit-llvm -o - | FileCheck %s // This test is for a crash when emitting debug info for not-yet-completed // types. // Test that we don't actually emit a forward decl for the offending class: // CHECK: !DICompositeType(tag: DW_TAG_structure_type, name: "Derived" // CHECK-NOT: DIFlagFwdDecl // CHECK-SAME: ){{$}} // rdar://problem/15931354 template class Derived; template class Base { static Derived *create(); }; template struct Derived : Base { }; Base *f; // During the instantiation of Derived, Base becomes required to be // complete - since the declaration has already been emitted (due to 'f', // above), we immediately try to build debug info for Base which then // requires the (incomplete definition) of Derived which is problematic. // // (if 'f' is not present, the point at which Base becomes required to be // complete during the instantiation of Derived is a no-op because // Base was never emitted so we ignore it and carry on until we // wire up the base class of Derived in the debug info later on) Derived d;