1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s
2 
3 // rdar://20636558
4 
5 #pragma GCC diagnostic ignored "-Wincompatible-ms-struct"
6 #define ATTR __attribute__((__ms_struct__))
7 
8 struct ATTR VBase {
9   virtual void foo() = 0;
10 };
11 
12 struct ATTR Base : virtual VBase {
13   virtual void bar() = 0;
14 };
15 
16 struct ATTR Derived : Base {
17   Derived();
18   void foo();
19   void bar();
20   int value;
21 };
22 
23 // CHECK: [[DERIVED:%.*]] = type <{ [[BASE:%.*]], i32, [4 x i8] }>
24 // CHECK: [[BASE]] = type { [[VBASE:%.*]] }
25 // CHECK: [[VBASE]] = type { i32 (...)** }
26 
27 // CHECK: define void @_ZN7DerivedC2Ev
28 // CHECK:   [[SELF:%.*]] = load [[DERIVED]]*
29 // CHECK:   [[T0:%.*]] = bitcast [[DERIVED]]* [[SELF]] to [[BASE]]*
30 // CHECK:   call void @_ZN4BaseC2Ev([[BASE]]* [[T0]], i8**
31 // CHECK:   [[T0:%.*]] = getelementptr inbounds {{.*}} [[SELF]], i32 0, i32 1
32 // CHECK:   store i32 20, i32* [[T0]],
Derived()33 Derived::Derived() : value(20) {}
34