| 1 |
// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 2 |
// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 3 |
// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 4 |
// RUN: %clang_cc1 -std=c++17 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 5 |
// RUN: %clang_cc1 -std=c++20 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 6 |
// RUN: %clang_cc1 -std=c++23 %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 7 |
// RUN: %clang_cc1 -std=c++2c %s -triple x86_64-linux-gnu -emit-llvm -disable-llvm-passes -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK |
| 8 |
|
| 9 |
#if __cplusplus == 199711L |
| 10 |
#pragma clang diagnostic push |
| 11 |
#pragma clang diagnostic ignored "-Wvariadic-macros" |
| 12 |
#define static_assert(...) __extension__ _Static_assert(__VA_ARGS__) |
| 13 |
#pragma clang diagnostic pop |
| 14 |
#endif |
| 15 |
|
| 16 |
namespace cwg210 { // cwg210: 2.7 |
| 17 |
struct B { |
| 18 |
long i; |
| 19 |
B(); |
| 20 |
virtual ~B(); |
| 21 |
}; |
| 22 |
|
| 23 |
static_assert(sizeof(B) == 16, ""); |
| 24 |
|
| 25 |
struct D : B { |
| 26 |
long j; |
| 27 |
D(); |
| 28 |
}; |
| 29 |
|
| 30 |
static_assert(sizeof(D) == 24, ""); |
| 31 |
|
| 32 |
void toss(const B* b) { |
| 33 |
throw *b; |
| 34 |
} |
| 35 |
|
| 36 |
// CHECK-LABEL: define {{.*}} void @cwg210::toss(cwg210::B const*) |
| 37 |
// CHECK: %[[EXCEPTION:.*]] = call ptr @__cxa_allocate_exception(i64 16) |
| 38 |
// CHECK: call void @__cxa_throw(ptr %[[EXCEPTION]], ptr @typeinfo for cwg210::B, ptr @cwg210::B::~B()) |
| 39 |
// CHECK-LABEL: } |
| 40 |
|
| 41 |
} // namespace cwg210 |