// RUN: %clang_cc1 -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -cxx-abi microsoft %s 2>1.out \
// RUN:            |pause 10 \
// RUN:            | FileCheck -input-file=1.out %s

#pragma pack(4)
class B {
public:
  virtual void b(){}
  int b_field;
protected:
private:
};

class A : public B {
public:
  int a_field;
  virtual void a(){}
protected:
private:
};

class C : public virtual A, public B {
public:
  float c1_field;
  double c2_field;
  virtual void foo(){}
  virtual void bar(){}
protected:
private:
};

// This needs only for building layouts. 
// Without this clang doesn`t dump record layouts.
int main() {
  // This avoid "Can't yet mangle constructors!" for MS ABI.
  C* c;
  c->foo();
  return 0;
}

// CHECK:      0 | class B
// CHECK-NEXT: 0 |   (B vtable pointer)
// CHECK-NEXT: 4 |   int b_field

// CHECK:      0 | class A
// CHECK-NEXT: 0 |   class B (primary base)
// CHECK-NEXT: 0 |     (B vtable pointer)
// CHECK-NEXT: 4 |     int b_field
// CHECK-NEXT: 8 |   int a_field

// CHECK:       0 | class C
// CHECK-NEXT:  0 |   class B (primary base)
// CHECK-NEXT:  0 |     (B vtable pointer)
// CHECK-NEXT:  4 |     int b_field
// CHECK-NEXT:  8 |   (C vbtable pointer)
// CHECK-NEXT: 12 |   float c1_field
// CHECK-NEXT: 16 |   double c2_field
// CHECK-NEXT: 24 |   class A (virtual base)
// CHECK-NEXT: 24 |     class B (primary base)
// CHECK-NEXT: 24 |       (B vtable pointer)
// CHECK-NEXT: 28 |       int b_field
// CHECK-NEXT: 32 |     int a_field
