about summary refs log tree commit diff homepage
path: root/test/CXX/symex/libc++/catch_with_adjusted_exception_pointer.cpp
blob: e3bf08ad95488cf372cdd56f3aed3543af5199c8 (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
// REQUIRES: uclibc
// REQUIRES: libcxx
// REQUIRES: eh-cxx
// RUN: %clangxx %s -emit-llvm %O0opt -std=c++11 -c -I "%libcxx_include" -g -nostdinc++ -o %t.bc
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --exit-on-error --libcxx --libc=uclibc %t.bc 2>&1 | FileCheck %s

#include <iostream>

class Base {
public:
  int base_int = 42;
  virtual void print() {
    std::cout << "Base\n";
  }
};

class Derived : public Base {
public:
  virtual void print() {
    std::cout << "Derived\n";
  }
};

int main() {
  Base *bd = new Derived();
  // CHECK: Derived
  bd->print();

  try {
    throw bd;
  } catch (Base *b) {
    // CHECK: Derived
    b->print();
    // CHECK: 42
    std::cout << b->base_int << "\n";
  }
}