xref: /llvm-project/clang/test/CXX/drs/cwg199.cpp (revision ed128c7df9b4e60bfd814dc9fd22de1dde4a2c1c)
1*ed128c7dSVlad Serebrennikov // 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*ed128c7dSVlad Serebrennikov // 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*ed128c7dSVlad Serebrennikov // 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*ed128c7dSVlad Serebrennikov // 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*ed128c7dSVlad Serebrennikov // 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*ed128c7dSVlad Serebrennikov // 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*ed128c7dSVlad Serebrennikov // 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*ed128c7dSVlad Serebrennikov 
9*ed128c7dSVlad Serebrennikov #if __cplusplus == 199711L
10*ed128c7dSVlad Serebrennikov #define NOTHROW throw()
11*ed128c7dSVlad Serebrennikov #else
12*ed128c7dSVlad Serebrennikov #define NOTHROW noexcept(true)
13*ed128c7dSVlad Serebrennikov #endif
14*ed128c7dSVlad Serebrennikov 
15*ed128c7dSVlad Serebrennikov namespace cwg199 { // cwg199: 2.8
16*ed128c7dSVlad Serebrennikov struct A {
~Acwg199::A17*ed128c7dSVlad Serebrennikov   ~A() NOTHROW {}
18*ed128c7dSVlad Serebrennikov };
19*ed128c7dSVlad Serebrennikov 
20*ed128c7dSVlad Serebrennikov struct B {
~Bcwg199::B21*ed128c7dSVlad Serebrennikov   ~B() NOTHROW {}
22*ed128c7dSVlad Serebrennikov };
23*ed128c7dSVlad Serebrennikov 
foo()24*ed128c7dSVlad Serebrennikov void foo() {
25*ed128c7dSVlad Serebrennikov   A(), B();
26*ed128c7dSVlad Serebrennikov }
27*ed128c7dSVlad Serebrennikov 
28*ed128c7dSVlad Serebrennikov // CHECK-LABEL: define {{.*}} void @cwg199::foo()
29*ed128c7dSVlad Serebrennikov // CHECK-NOT:     call void @cwg199::A::~A()
30*ed128c7dSVlad Serebrennikov // CHECK:         call void @cwg199::B::~B()
31*ed128c7dSVlad Serebrennikov // CHECK:         call void @cwg199::A::~A()
32*ed128c7dSVlad Serebrennikov // CHECK-LABEL: }
33*ed128c7dSVlad Serebrennikov } // namespace cwg199
34