// RUN: rm -rf %t // RUN: mkdir %t // RUN: split-file %s %t // // RUN: %clang_cc1 -xc++ -std=c++20 -fmodules -fmodule-name=library \ // RUN: -emit-module %t/modules.map \ // RUN: -o %t/module.pcm // // // RUN: %clang_cc1 -xc++ -std=c++20 -fmodules -fmodule-file=%t/module.pcm \ // RUN: -fmodule-map-file=%t/modules.map \ // RUN: -fsyntax-only -verify %t/use.cpp // //--- use.cpp // expected-no-diagnostics #include "concepts.h" #include "format.h" template void foo() requires same_as {} //--- modules.map module "library" { export * module "concepts" { export * header "concepts.h" } module "compare" { export * header "compare.h" } module "format" { export * header "format.h" } } //--- concepts.h #ifndef SAMEAS_CONCEPTS_H_ #define SAMEAS_CONCEPTS_H_ #include "same_as.h" #endif // SAMEAS_CONCEPTS_H //--- same_as.h #ifndef SAME_AS_H #define SAME_AS_H template concept same_as_impl = __is_same(T, U); template concept same_as = same_as_impl && same_as_impl; #endif // SAME_AS_H //--- compare.h #ifndef COMPARE_H #define COMPARE_H #include "same_as.h" #include "concepts.h" template void foo() requires same_as {} #endif // COMPARE_H //--- format.h #ifndef FORMAT_H #define FORMAT_H #include "same_as.h" #include "concepts.h" template void bar() requires same_as {} #endif // FORMAT_H