1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -triple i686-linux-gnu %s -emit-llvm -o - | FileCheck %s 2*0a6a1f1dSLionel Sambuc 3*0a6a1f1dSLionel Sambuc class A { 4*0a6a1f1dSLionel Sambuc // append has to have the same prototype as fn1 to tickle the bug. 5*0a6a1f1dSLionel Sambuc void (*append)(A *); 6*0a6a1f1dSLionel Sambuc }; 7*0a6a1f1dSLionel Sambuc 8*0a6a1f1dSLionel Sambuc class B {}; 9*0a6a1f1dSLionel Sambuc class D; 10*0a6a1f1dSLionel Sambuc 11*0a6a1f1dSLionel Sambuc // C has to be non-C++98 POD with available tail padding, making the LLVM base 12*0a6a1f1dSLionel Sambuc // type differ from the complete LLVM type. 13*0a6a1f1dSLionel Sambuc class C { 14*0a6a1f1dSLionel Sambuc // This member creates a circular LLVM type reference to %class.D. 15*0a6a1f1dSLionel Sambuc D *m_group; 16*0a6a1f1dSLionel Sambuc B changeListeners; 17*0a6a1f1dSLionel Sambuc }; 18*0a6a1f1dSLionel Sambuc class D : C {}; 19*0a6a1f1dSLionel Sambuc fn1(A * p1)20*0a6a1f1dSLionel Sambucvoid fn1(A *p1) { 21*0a6a1f1dSLionel Sambuc } 22*0a6a1f1dSLionel Sambuc 23*0a6a1f1dSLionel Sambuc void fn2(C *)24*0a6a1f1dSLionel Sambucfn2(C *) { 25*0a6a1f1dSLionel Sambuc } 26*0a6a1f1dSLionel Sambuc 27*0a6a1f1dSLionel Sambuc // We end up using an opaque type for 'append' to avoid circular references. 28*0a6a1f1dSLionel Sambuc // CHECK: %class.A = type { {}* } 29*0a6a1f1dSLionel Sambuc // CHECK: %class.C = type <{ %class.D*, %class.B, [3 x i8] }> 30*0a6a1f1dSLionel Sambuc // CHECK: %class.D = type { %class.C.base, [3 x i8] } 31*0a6a1f1dSLionel Sambuc // CHECK: %class.C.base = type <{ %class.D*, %class.B }> 32*0a6a1f1dSLionel Sambuc // CHECK: %class.B = type { i8 } 33