| 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,SINCE-CXX11 |
| 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,SINCE-CXX11 |
| 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,SINCE-CXX11 |
| 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,SINCE-CXX11 |
| 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,SINCE-CXX11 |
| 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,SINCE-CXX11 |
| 8 |
|
| 9 |
namespace cwg2504 { // cwg2504: no |
| 10 |
#if __cplusplus >= 201103L |
| 11 |
struct V { V() = default; V(int); }; |
| 12 |
struct Q { Q(); }; |
| 13 |
struct A : virtual V, Q { |
| 14 |
using V::V; |
| 15 |
A() = delete; |
| 16 |
}; |
| 17 |
int bar() { return 42; } |
| 18 |
struct B : A { |
| 19 |
B() : A(bar()) {} // ok |
| 20 |
}; |
| 21 |
struct C : B {}; |
| 22 |
void foo() { C c; } // bar is not invoked, because the V subobject is not initialized as part of B |
| 23 |
#endif |
| 24 |
} // namespace cwg2504 |
| 25 |
|
| 26 |
// FIXME: As specified in the comment above (which comes from an example in the Standard), |
| 27 |
// we are not supposed to unconditionally call `bar()` and call a constructor |
| 28 |
// inherited from `V`. |
| 29 |
|
| 30 |
// SINCE-CXX11-LABEL: define linkonce_odr void @cwg2504::B::B() |
| 31 |
// SINCE-CXX11-NOT: br |
| 32 |
// SINCE-CXX11: call noundef i32 @cwg2504::bar() |
| 33 |
// SINCE-CXX11-NOT: br |
| 34 |
// SINCE-CXX11: call void @cwg2504::A::A(int) |
| 35 |
// SINCE-CXX11-LABEL: } |
| 36 |
|
| 37 |
// CHECK: {{.*}} |