xref: /llvm-project/clang/test/Modules/concept_serialization.cpp (revision babdef27c503c0bbbcc017e9f88affddda90ea4e)
1 // RUN: rm -rf %t
2 // RUN: %clang_cc1 -std=c++20 -fmodules-cache-path=%t -x c++ %s -verify
3 // expected-no-diagnostics
4 #pragma clang module build std
5 module std [system] { module concepts [system] {} }
6 #pragma clang module contents
7 
8 #pragma clang module begin std.concepts
9 template <class T>
10 T declval();
11 template<class T, class U>
12 concept common_reference_with = T::val;
13 template<class T>
14 concept input_or_output_iterator = true;
15 template <class T>
16 concept input_iterator = input_or_output_iterator<T> &&
17                          common_reference_with<decltype(declval<T&>)&&, T&>;
18 #pragma clang module end /*std.concepts*/
19 #pragma clang module endbuild /*std*/
20 
21 #pragma clang module import std.concepts
22 template<input_or_output_iterator>
23 struct iter_value_or_void{};
24 // ensure that we don't assert on a subsumption check due to improper
25 // deserialization.
26 template<input_iterator I>
27 struct iter_value_or_void<I>{};
28