1 // RUN: %clang_cc1 -fno-rtti -fexceptions %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
2 
3 // CHECK: @_ZTIN5test11AE = weak_odr constant
4 // CHECK: @_ZTIN5test11BE = weak_odr constant
5 // CHECK: @_ZTIN5test11CE = weak_odr constant
6 // CHECK: @_ZTIN5test11DE = weak_odr constant
7 // CHECK: @_ZTIPN5test11DE = weak_odr constant {{.*}} @_ZTIN5test11DE
8 
9 // PR6974: this shouldn't crash
10 namespace test0 {
11   class err {};
12 
13   void f(void) {
14     try {
15     } catch (err &) {
16     }
17   }
18 }
19 
20 namespace test1 {
21   // These classes have key functions defined out-of-line.
22   // Under normal circumstances, we wouldn't generate RTTI for them;
23   // under -fno-rtti, we generate RTTI only when required by EH.
24   class A { virtual void foo(); };
25   class B { virtual void foo(); };
26   class C { virtual void foo(); };
27   class D { virtual void foo(); };
28 
29   void opaque();
30 
31   void test0() {
32     throw A();
33   }
34 
35   void test1() throw(B) {
36     opaque();
37   }
38 
39   void test2() {
40     try {
41       opaque();
42     } catch (C&) {}
43   }
44 
45   void test3(D *ptr) {
46     throw ptr;
47   };
48 }
49