1 // RUN: rm -rf %t 2 // RUN: mkdir %t 3 // RUN: split-file %s %t 4 // 5 // RUN: %clang_cc1 -xc++ -std=c++20 -fmodules -fmodule-name=library \ 6 // RUN: -emit-module %t/modules.map \ 7 // RUN: -o %t/module.pcm 8 // 9 // 10 // RUN: %clang_cc1 -xc++ -std=c++20 -fmodules -fmodule-file=%t/module.pcm \ 11 // RUN: -fmodule-map-file=%t/modules.map \ 12 // RUN: -fsyntax-only -verify %t/use.cpp 13 // 14 //--- use.cpp 15 // expected-no-diagnostics 16 17 #include "concepts.h" 18 #include "format.h" 19 20 template <class T> void foo() 21 requires same_as<T, T> 22 {} 23 24 //--- modules.map 25 module "library" { 26 export * 27 module "concepts" { 28 export * 29 header "concepts.h" 30 } 31 module "format" { 32 export * 33 header "format.h" 34 } 35 } 36 37 //--- concepts.h 38 #ifndef SAMEAS_CONCEPTS_H_ 39 #define SAMEAS_CONCEPTS_H_ 40 41 #include "same_as.h" 42 43 #endif // SAMEAS_CONCEPTS_H 44 45 //--- same_as.h 46 #ifndef SAME_AS_H 47 #define SAME_AS_H 48 49 template <class T, class U> 50 concept same_as = __is_same(T, U); 51 52 #endif // SAME_AS_H 53 54 //--- format.h 55 #ifndef FORMAT_H 56 #define FORMAT_H 57 58 #include "concepts.h" 59 #include "same_as.h" 60 61 template <class T> void foo() 62 requires same_as<T, int> 63 {} 64 65 #endif // FORMAT_H