typeid.cpp revision 3a01693f9e05207a3ba6dfca49b457649979e3e2
1// RUN: %clang_cc1 -I%S %s -triple x86_64-apple-darwin10 -emit-llvm -fcxx-exceptions -fexceptions -o - | FileCheck %s
2#include <typeinfo>
3
4namespace Test1 {
5
6// PR7400
7struct A { virtual void f(); };
8
9// CHECK: define i8* @_ZN5Test11fEv
10const char *f() {
11  try {
12    // CHECK: br i1
13    // CHECK: invoke void @__cxa_bad_typeid() noreturn
14    return typeid(*static_cast<A *>(0)).name();
15  } catch (...) {
16    // CHECK: call i8* @llvm.eh.exception
17  }
18
19  return 0;
20}
21
22}
23