1// RUN: rm -rf %t 2// RUN: mkdir -p %t 3// RUN: split-file %s %t 4// 5// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/lib.cppm -o %t/lib.pcm 6// RUN: %clang_cc1 -std=c++20 %t/main.cpp -fmodule-file=lib=%t/lib.pcm \ 7// RUN: -verify -fsyntax-only 8 9// Test again with reduced BMI 10// RUN: rm -rf %t 11// RUN: mkdir -p %t 12// RUN: split-file %s %t 13// 14// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/lib.cppm -o %t/lib.pcm 15// RUN: %clang_cc1 -std=c++20 %t/main.cpp -fmodule-file=lib=%t/lib.pcm \ 16// RUN: -verify -fsyntax-only 17 18//--- header.h 19namespace lib::inline __1 { 20template <class> 21inline constexpr bool test = false; 22template <class> 23constexpr bool func() { 24 return false; 25} 26inline constexpr bool non_templ = true; 27} // namespace lib 28 29//--- lib.cppm 30module; 31#include "header.h" 32export module lib; 33 34export namespace lib { 35 using lib::test; 36 using lib::func; 37 using lib::non_templ; 38} // namespace lib 39 40//--- main.cpp 41// expected-no-diagnostics 42import lib; 43 44struct foo {}; 45 46template <> 47inline constexpr bool lib::test<foo> = true; 48 49template <> 50constexpr bool lib::func<foo>() { 51 return true; 52} 53 54static_assert(lib::test<foo>); 55static_assert(lib::func<foo>()); 56