brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · a3d9696 Raw
52 lines · cpp
1// RUN: %clang_cc1 -fno-rtti -fcxx-exceptions -fexceptions -Wno-dynamic-exception-spec %s -triple=x86_64-apple-darwin10 -emit-llvm -o - %std_cxx98- | FileCheck %s2 3// CHECK: @_ZTIN5test11AE = linkonce_odr constant4// CHECK: @_ZTIN5test11BE = linkonce_odr constant5// CHECK: @_ZTIN5test11CE = linkonce_odr constant6// CHECK: @_ZTIPN5test11DE = linkonce_odr constant {{.*}} @_ZTIN5test11DE7// CHECK: @_ZTIN5test11DE = linkonce_odr constant8 9// PR6974: this shouldn't crash10namespace test0 {11  class err {};12 13  void f(void) {14    try {15    } catch (err &) {16    }17  }18}19 20namespace test1 {21  // These classes have key functions defined out-of-line.  Under22  // normal circumstances, we wouldn't generate RTTI for them; under23  // -fno-rtti, we generate RTTI only when required by EH.  But24  // everything gets hidden visibility because we assume that all25  // users are also compiled under -fno-rtti and therefore will be26  // emitting RTTI regardless of key function.27  class A { virtual void foo(); };28  class B { virtual void foo(); };29  class C { virtual void foo(); };30  class D { virtual void foo(); };31 32  void opaque();33 34  void test0() {35    throw A();36  }37 38  void test1() throw(B) {39    opaque();40  }41 42  void test2() {43    try {44      opaque();45    } catch (C&) {}46  }47 48  void test3(D *ptr) {49    throw ptr;50  };51}52