brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · bb488ff Raw
56 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/lib.cppm -o %t/lib.pcm6// RUN: %clang_cc1 -std=c++20 %t/main.cpp -fmodule-file=lib=%t/lib.pcm \7// RUN:     -verify -fsyntax-only8 9// Test again with reduced BMI10// RUN: rm -rf %t11// RUN: mkdir -p %t12// RUN: split-file %s %t13//14// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/lib.cppm -o %t/lib.pcm15// RUN: %clang_cc1 -std=c++20 %t/main.cpp -fmodule-file=lib=%t/lib.pcm \16// RUN:     -verify -fsyntax-only17 18//--- header.h19namespace 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 lib28 29//--- lib.cppm30module;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 lib39 40//--- main.cpp41// expected-no-diagnostics42import 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