3 // RUN: split-file %s %t
5 // RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
6 // RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm
7 // RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface \
8 // RUN: -fprebuilt-module-path=%t -o %t/c.pcm
9 // RUN: %clang_cc1 -std=c++20 %t/use.cpp -fprebuilt-module-path=%t \
10 // RUN: -fsyntax-only -verify
12 // Test again with reduced BMI.
15 // RUN: split-file %s %t
17 // RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm
18 // RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -o %t/b.pcm
19 // RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-reduced-module-interface \
20 // RUN: -fprebuilt-module-path=%t -o %t/c.pcm
21 // RUN: %clang_cc1 -std=c++20 %t/use.cpp -fprebuilt-module-path=%t \
22 // RUN: -fsyntax-only -verify
29 concept __has_member_value_type = requires { typename _Tp::value_type; };
32 concept __has_member_element_type = requires { typename _Tp::element_type; };
35 inline constexpr bool is_object_v = __is_object(_Tp);
37 template<class> struct __cond_value_type {};
40 requires is_object_v<_Tp>
41 struct __cond_value_type<_Tp> { using value_type = bool; };
43 template<class> struct indirectly_readable_traits {
44 static constexpr int value = false;
48 //--- foo.member_value_type.h
50 template<__has_member_value_type _Tp>
51 struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {
52 static constexpr int value = false;
55 //--- foo.memeber_element_type.h
57 template<__has_member_element_type _Tp>
58 struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::element_type> {
59 static constexpr int value = false;
62 template<__has_member_value_type _Tp>
63 requires __has_member_element_type<_Tp>
64 struct indirectly_readable_traits<_Tp> {
65 static constexpr int value = true;
70 #include "foo.member_value_type.h"
71 #include "foo.memeber_element_type.h"
73 using AType = indirectly_readable_traits<T>;
85 #include "foo.memeber_element_type.h"
95 // expected-no-diagnostics
101 using value_type = T;
102 using element_type = T;
105 template <typename T>
110 static_assert(!AType<V<int*>>::value);
111 static_assert(AType<U<int**>>::value);