// RUN: rm -rf %t // RUN: mkdir -p %t // RUN: split-file %s %t // // Full BMI: both EIDs survive. // RUN: %clang_cc1 -std=c++20 %t/M.cppm -I%t -emit-module-interface -o %t/M.pcm // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/use.cpp -verify -fsyntax-only // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/use.cpp -ast-dump-all 2>&1 | FileCheck %s --check-prefix=FULL // // Reduced BMI: both EIDs survive (linked from the specialization). // RUN: %clang_cc1 -std=c++20 %t/M.cppm -I%t -emit-reduced-module-interface -o %t/M.pcm // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/use.cpp -verify -fsyntax-only // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/use.cpp -ast-dump-all 2>&1 | FileCheck %s --check-prefix=REDUCED //--- header.h #ifndef HEADER_H #define HEADER_H template struct GMFStruct { T value; T get() const { return value; } }; #endif //--- M.cppm module; #include "header.h" // Explicit instantiation in GMF. template struct GMFStruct; export module M; export template struct PurvStruct { T value; T get() const { return value; } }; // Explicit instantiation in module purview. template struct PurvStruct; export using ::GMFStruct; //--- use.cpp // expected-no-diagnostics import M; // FULL: ExplicitInstantiationDecl {{.*}} imported in M. {{.*}} explicit_instantiation_definition 'GMFStruct' // FULL: ExplicitInstantiationDecl {{.*}} imported in M {{.*}} explicit_instantiation_definition 'PurvStruct' // REDUCED: ExplicitInstantiationDecl {{.*}} imported in M. {{.*}} explicit_instantiation_definition 'GMFStruct' // REDUCED: ExplicitInstantiationDecl {{.*}} imported in M {{.*}} explicit_instantiation_definition 'PurvStruct' void test() { GMFStruct g; g.value = 1; PurvStruct p; p.value = 2; }