| 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 |
// We aren't testing this since C++26 because of P2748R5 "Disallow Binding a Returned Glvalue to a Temporary". |
| 8 |
|
| 9 |
#if __cplusplus == 199711L |
| 10 |
#define NOTHROW throw() |
| 11 |
#else |
| 12 |
#define NOTHROW noexcept(true) |
| 13 |
#endif |
| 14 |
|
| 15 |
namespace cwg650 { // cwg650: 2.8 |
| 16 |
|
| 17 |
struct Q { |
| 18 |
~Q() NOTHROW; |
| 19 |
}; |
| 20 |
|
| 21 |
struct R { |
| 22 |
~R() NOTHROW; |
| 23 |
}; |
| 24 |
|
| 25 |
struct S { |
| 26 |
~S() NOTHROW; |
| 27 |
}; |
| 28 |
|
| 29 |
const S& f() { |
| 30 |
Q q; |
| 31 |
return (R(), S()); |
| 32 |
} |
| 33 |
|
| 34 |
} // namespace cwg650 |
| 35 |
|
| 36 |
// CHECK-LABEL: define {{.*}} @cwg650::f()() |
| 37 |
// CHECK: call void @cwg650::S::~S() |
| 38 |
// CHECK: call void @cwg650::R::~R() |
| 39 |
// CHECK: call void @cwg650::Q::~Q() |
| 40 |
// CHECK-LABEL: } |