252
|
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 //--- base.cppm
|
|
16 export module package:base;
|
|
17
|
|
18 export struct child;
|
|
19
|
|
20 export
|
|
21 template<class> struct base
|
|
22 {
|
|
23 child getChild();
|
|
24 };
|
|
25
|
|
26
|
|
27 //--- child.cppm
|
|
28 export module package:child;
|
|
29
|
|
30 import :base;
|
|
31
|
|
32 export struct child : base<void> {};
|
|
33
|
|
34 template<class T>
|
|
35 child base<T>::getChild() { return {}; }
|
|
36
|
|
37 //--- package.cppm
|
|
38 export module package;
|
|
39
|
|
40 export import :base;
|
|
41 export import :child;
|
|
42
|
|
43 //--- use.cpp
|
|
44 // expected-no-diagnostics
|
|
45 import package;
|
|
46
|
|
47 int use()
|
|
48 {
|
|
49 base<void>{}.getChild();
|
|
50 base<int>{}.getChild();
|
|
51 return 0;
|
|
52 }
|