about summary refs log tree commit diff homepage
path: root/test/CXX/symex/basic_c++/inheritance.cpp
blob: 88a0d150865e4f9f0d3a515dbf934795b7f44d98 (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
// 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>
class Testclass {
public:
  Testclass() {
    printf("Testclass constructor\n");
  }
  int a() {
    return 1;
  }
};
class Derivedclass : public Testclass {
public:
  Derivedclass() {
    printf("Derivedclass constructor\n");
  }
  int b() {
    return 2;
  }
};

int main(int argc, char **args) {
  Derivedclass x;
  // CHECK: Testclass constructor
  // CHECK: Derivedclass constructor

  printf("%d / %d", x.a(), x.b());
  // CHECK: 1 / 2

  return x.a() + x.b();
}