1 // RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -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 -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 -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 -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 -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 -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 -o - -fexceptions -fcxx-exceptions -pedantic-errors | llvm-cxxfilt -n | FileCheck %s --check-prefixes CHECK
8
9 #if __cplusplus == 199711L
10 #define NOTHROW throw()
11 #else
12 #define NOTHROW noexcept(true)
13 #endif
14
15 namespace cwg193 { // cwg193: 2.7
16 struct A {
~Acwg193::A17 ~A() NOTHROW {}
18 };
19
20 struct B {
~Bcwg193::B21 ~B() NOTHROW {}
22 };
23
24 struct C {
~Ccwg193::C25 ~C() NOTHROW {}
26 };
27
28 struct D : A {
29 B b;
~Dcwg193::D30 ~D() NOTHROW { C c; }
31 };
32
foo()33 void foo() {
34 D d;
35 }
36
37 // skipping over D1 (complete object destructor)
38 // CHECK-LABEL: define {{.*}} void @cwg193::D::~D(){{.*}}
39 // CHECK-LABEL: define {{.*}} void @cwg193::D::~D(){{.*}}
40 // CHECK-NOT: call void @cwg193::A::~A()
41 // CHECK-NOT: call void @cwg193::B::~B()
42 // CHECK: call void @cwg193::C::~C()
43 // CHECK: call void @cwg193::B::~B()
44 // CHECK: call void @cwg193::A::~A()
45 // CHECK-LABEL: }
46 } // namespace cwg193
47