1// RUN: rm -rf %t 2// RUN: mkdir -p %t 3// RUN: split-file %s %t 4// 5// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm 6// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \ 7// RUN: -fprebuilt-module-path=%t 8// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -o %t/c.pcm \ 9// RUN: -fprebuilt-module-path=%t 10// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-module-interface -o %t/d.pcm \ 11// RUN: -fprebuilt-module-path=%t 12// RUN: %clang_cc1 -std=c++20 %t/e.cpp -fsyntax-only -verify -fprebuilt-module-path=%t 13 14// Test again with reduced BMI 15// RUN: rm -rf %t 16// RUN: mkdir -p %t 17// RUN: split-file %s %t 18// 19// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm 20// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -o %t/b.pcm \ 21// RUN: -fprebuilt-module-path=%t 22// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-reduced-module-interface -o %t/c.pcm \ 23// RUN: -fprebuilt-module-path=%t 24// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-reduced-module-interface -o %t/d.pcm \ 25// RUN: -fprebuilt-module-path=%t 26// RUN: %clang_cc1 -std=c++20 %t/e.cpp -fsyntax-only -verify -fprebuilt-module-path=%t 27 28 29//--- a.cppm 30export 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.cppm 44export 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.cppm 60export 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.cppm 69// expected-no-diagnostics 70export 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.cpp 80import d; 81import b; 82 83// expected-no-diagnostics 84void foo(AnySpan<const int> s) { 85 s = AnySpan<const int>(s); 86} 87