]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Modules/cxx17-exception-spec.cpp
Vendor import of clang trunk r338150:
[FreeBSD/FreeBSD.git] / test / Modules / cxx17-exception-spec.cpp
1 // RUN: %clang_cc1 -fmodules -fmodules-local-submodule-visibility -fno-modules-error-recovery -fno-spell-checking -verify -std=c++17 %s
2
3 #pragma clang module build a
4 module a {}
5 #pragma clang module contents
6 #pragma clang module begin a
7 constexpr bool return_true() { return true; }
8 struct X {
9   static void f() noexcept(return_true());
10 };
11 #pragma clang module end
12 #pragma clang module endbuild
13
14 #pragma clang module build b
15 module b {}
16 #pragma clang module contents
17 #pragma clang module begin b
18 #pragma clang module import a
19 using T = decltype(return_true() && noexcept(X::f()));
20 #pragma clang module end
21 #pragma clang module endbuild
22
23 #pragma clang module import a
24 #pragma clang module import b
25
26 // Trigger import of return_true and then X::f in the same pass. This causes
27 // the type of X::f to be loaded while we have a pending body for return_true,
28 // which means evaluation of its exception specification at that point would
29 // fail.
30 T t;
31
32 static_assert(noexcept(X().f()));
33
34 // expected-no-diagnostics