87 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm6// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \7// RUN: -fprebuilt-module-path=%t8// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -o %t/c.pcm \9// RUN: -fprebuilt-module-path=%t10// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-module-interface -o %t/d.pcm \11// RUN: -fprebuilt-module-path=%t12// RUN: %clang_cc1 -std=c++20 %t/e.cpp -fsyntax-only -verify -fprebuilt-module-path=%t13 14// Test again with reduced BMI15// RUN: rm -rf %t16// RUN: mkdir -p %t17// RUN: split-file %s %t18//19// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm20// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -o %t/b.pcm \21// RUN: -fprebuilt-module-path=%t22// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-reduced-module-interface -o %t/c.pcm \23// RUN: -fprebuilt-module-path=%t24// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-reduced-module-interface -o %t/d.pcm \25// RUN: -fprebuilt-module-path=%t26// RUN: %clang_cc1 -std=c++20 %t/e.cpp -fsyntax-only -verify -fprebuilt-module-path=%t27 28 29//--- a.cppm30export module a;31 32struct WithCtor {33 WithCtor();34};35 36export template <typename T>37struct Getter {38 union {39 WithCtor container;40 };41};42 43//--- b.cppm44export module b;45 46import a;47 48export template <typename T>49class AnySpan {50 public:51 AnySpan();52 AnySpan(Getter<T> getter)53 : getter_(getter) {}54 55 private:56 Getter<T> getter_;57};58 59//--- c.cppm60export module c;61import b;62 63export inline void RegisterInt322(64 AnySpan<const int> sibling_field_nums) {65 sibling_field_nums = sibling_field_nums;66}67 68//--- d.cppm69// expected-no-diagnostics70export module d;71import c;72import b;73 74export inline void RegisterInt32(75 AnySpan<const int> sibling_field_nums = {}) {76 sibling_field_nums = sibling_field_nums;77}78 79//--- e.cpp80import d;81import b;82 83// expected-no-diagnostics84void foo(AnySpan<const int> s) {85 s = AnySpan<const int>(s);86}87