49 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -emit-module-interface -o %t/foo.pcm6// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -fsyntax-only -verify7 8// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -emit-reduced-module-interface -o %t/foo.pcm9// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -fsyntax-only -verify10//11//--- bar.h12struct bar_base {13 enum A {14 a,15 b,16 c,17 d18 };19 constexpr static bool value = false;20 static bool get() { return false; }21 bool member_value = false;22 bool get_func() { return false; }23};24 25template <typename T>26struct bar : public bar_base {27};28 29//--- foo.cppm30module;31#include "bar.h"32export module foo;33export template <typename T>34int foo() {35 bool a = bar<T>::value;36 bar<T>::get();37 bar<T> b;38 b.member_value = a;39 bool c = b.get_func();40 return bar<T>::a;41}42 43//--- Use.cpp44// expected-no-diagnostics45import foo;46void test() {47 foo<int>();48}49