about summary refs log tree commit diff homepage
path: root/test/CXX/symex/basic_c++/diamond.cpp
blob: 479a9090f7b0bea3b251738c8dad2937a7c3689c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// REQUIRES: uclibc
// RUN: %clangxx %s -emit-llvm %O0opt -c -o %t.bc
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --libc=uclibc %t.bc 2>&1 | FileCheck %s

#include <cstdio>

struct A {
  int a;
  A() {
    printf("A constructor\n");
  }
};

struct B : virtual A {
  int b;
  B() {
    printf("B constructor\n");
  }
};

struct C : virtual A {
  int c;
  C() {
    printf("C constructor\n");
  }
};

struct D : B, C {
  int d;
};

int main(int argc, char **args) {
  D x;
  // CHECK: A constructor
  // CHECK: B constructor
  // CHECK: C constructor

  x.a = 7;
  B *y = &x;
  printf("B::a = %d\n", y->a);
  // CHECK: B::a = 7

  return 0;
}