[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / GH60336-2.cpp
blob9740c744b7b7bed110e3b7f219eef41b67c569bb
1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -x c++ -std=c++20 %s -verify -fmodules -fmodules-cache-path=%t
3 // expected-no-diagnostics
5 #pragma clang module build std
6 module std {
7 module concepts {}
8 module functional {}
10 #pragma clang module contents
11 #pragma clang module begin std
13 template <class _Tp> struct common_reference {
14 using type = _Tp;
17 #pragma clang module end
18 #pragma clang module begin std.concepts
19 #pragma clang module import std
21 template <class _Tp>
22 concept same_as = __is_same(_Tp, _Tp);
24 template <class _Tp>
25 concept common_reference_with =
26 same_as<typename common_reference<_Tp>::type>;
28 #pragma clang module end
29 #pragma clang module begin std.functional
30 #pragma clang module import std.concepts
32 template <class, class _Ip>
33 concept sentinel_for = common_reference_with<_Ip>;
35 constexpr bool ntsf_subsumes_sf(sentinel_for<char *> auto)
36 requires true
38 return true;
40 bool ntsf_subsumes_sf(sentinel_for<char *> auto);
41 static_assert(ntsf_subsumes_sf(""));
43 #pragma clang module end
44 #pragma clang module endbuild