[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / exception-spec.cpp
bloba1fcc2238ad3db908de15f84f69c201cf449a68c
1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -x c++ -std=c++17 -fmodules -fmodules-local-submodule-visibility -fmodules-cache-path=%t %s -verify
4 // expected-no-diagnostics
6 #pragma clang module build PR38627
7 module PR38627 {}
8 #pragma clang module contents
9 #pragma clang module begin PR38627
10 namespace PR38627 {
11 struct X {
12 virtual ~X() {}
13 struct C {
14 friend X::~X();
15 } c;
18 #pragma clang module end
19 #pragma clang module endbuild
21 #pragma clang module import PR38627
23 namespace PR38627 {
24 struct Y {
25 virtual ~Y() {}
26 struct C {
27 friend Y::~Y();
28 } c;
30 static_assert(noexcept(X().~X()));
31 static_assert(noexcept(Y().~Y()));
33 struct A { virtual ~A() = default; };
34 struct B : public A, public X {
35 virtual ~B() override = default;
37 } // PR38627