| 1 |
// This comes from the issue report of MSVC |
| 2 |
// (https://developercommunity.visualstudio.com/t/c20-modules-unresolved-external-symbol/10049210). |
| 3 |
// |
| 4 |
// RUN: rm -rf %t |
| 5 |
// RUN: mkdir %t |
| 6 |
// RUN: split-file %s %t |
| 7 |
// |
| 8 |
// RUN: %clang_cc1 -std=c++20 %t/base.cppm -emit-module-interface -o %t/package-base.pcm |
| 9 |
// RUN: %clang_cc1 -std=c++20 %t/child.cppm -emit-module-interface -o %t/package-child.pcm \ |
| 10 |
// RUN: -fprebuilt-module-path=%t |
| 11 |
// RUN: %clang_cc1 -std=c++20 %t/package.cppm -emit-module-interface -o %t/package.pcm \ |
| 12 |
// RUN: -fprebuilt-module-path=%t |
| 13 |
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fsyntax-only -verify -fprebuilt-module-path=%t |
| 14 |
|
| 15 |
// Test again with reduced BMI |
| 16 |
// RUN: rm -rf %t |
| 17 |
// RUN: mkdir %t |
| 18 |
// RUN: split-file %s %t |
| 19 |
// |
| 20 |
// RUN: %clang_cc1 -std=c++20 %t/base.cppm -emit-reduced-module-interface -o %t/package-base.pcm |
| 21 |
// RUN: %clang_cc1 -std=c++20 %t/child.cppm -emit-reduced-module-interface -o %t/package-child.pcm \ |
| 22 |
// RUN: -fprebuilt-module-path=%t |
| 23 |
// RUN: %clang_cc1 -std=c++20 %t/package.cppm -emit-reduced-module-interface -o %t/package.pcm \ |
| 24 |
// RUN: -fprebuilt-module-path=%t |
| 25 |
// RUN: %clang_cc1 -std=c++20 %t/use.cpp -fsyntax-only -verify -fprebuilt-module-path=%t |
| 26 |
|
| 27 |
//--- base.cppm |
| 28 |
export module package:base; |
| 29 |
|
| 30 |
export struct child; |
| 31 |
|
| 32 |
export |
| 33 |
template<class> struct base |
| 34 |
{ |
| 35 |
child getChild(); |
| 36 |
}; |
| 37 |
|
| 38 |
|
| 39 |
//--- child.cppm |
| 40 |
export module package:child; |
| 41 |
|
| 42 |
import :base; |
| 43 |
|
| 44 |
export struct child : base<void> {}; |
| 45 |
|
| 46 |
template<class T> |
| 47 |
child base<T>::getChild() { return {}; } |
| 48 |
|
| 49 |
//--- package.cppm |
| 50 |
export module package; |
| 51 |
|
| 52 |
export import :base; |
| 53 |
export import :child; |
| 54 |
|
| 55 |
//--- use.cpp |
| 56 |
// expected-no-diagnostics |
| 57 |
import package; |
| 58 |
|
| 59 |
int use() |
| 60 |
{ |
| 61 |
base<void>{}.getChild(); |
| 62 |
base<int>{}.getChild(); |
| 63 |
return 0; |
| 64 |
} |