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
17 concept __has_member_value_type = requires { typename _Tp::value_type; };
20 concept __has_member_element_type = requires { typename _Tp::element_type; };
23 inline constexpr bool is_object_v = __is_object(_Tp);
25 template<class> struct __cond_value_type {};
28 requires is_object_v<_Tp>
29 struct __cond_value_type<_Tp> { using value_type = bool; };
31 template<class> struct indirectly_readable_traits {
32 static constexpr int value = false;
36 //--- foo.member_value_type.h
38 template<__has_member_value_type _Tp>
39 struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::value_type> {
40 static constexpr int value = false;
43 //--- foo.memeber_element_type.h
45 template<__has_member_element_type _Tp>
46 struct indirectly_readable_traits<_Tp> : __cond_value_type<typename _Tp::element_type> {
47 static constexpr int value = false;
50 template<__has_member_value_type _Tp>
51 requires __has_member_element_type<_Tp>
52 struct indirectly_readable_traits<_Tp> {
53 static constexpr int value = true;
58 #include "foo.member_value_type.h"
59 #include "foo.memeber_element_type.h"
61 using AType = indirectly_readable_traits<T>;
73 #include "foo.memeber_element_type.h"
83 // expected-no-diagnostics
90 using element_type = T;
98 static_assert(!AType<V<int*>>::value);
99 static_assert(AType<U<int**>>::value);