about summary refs log tree commit diff homepage
path: root/test/CXX/symex/libc++/throw_specifiers.cpp
blob: efd6a0be0963b03f9c580fcc8d17bf88f45688d7 (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
// Testcase for proper handling of
// throw specifications on functions
// REQUIRES: uclibc
// REQUIRES: libcxx
// REQUIRES: eh-cxx
// RUN: %clangxx %s -emit-llvm %O0opt -std=c++11 -c %libcxx_includes -g -nostdinc++ -o %t.bc
// RUN: rm -rf %t.klee-out
// RUN: %klee --output-dir=%t.klee-out --libcxx --libc=uclibc  %t.bc | FileCheck %s

#include <stdio.h>

namespace {
void throw_expected() throw(int) {
  throw 5;
}

void throw_unexpected() throw(int, double) {
  throw "unexpected string";
}
} // namespace

int main() {
  try {
    throw_expected();
  } catch (int i) {
    puts("caught expected int");
    // CHECK: caught expected int
  }

  try {
    throw_unexpected();
  } catch (char const *s) {
    puts("caught unexpected string");
    // CHECK-NOT: caught unexpected string
  }
}