xref: /llvm-project/clang/test/Modules/pr68702.cpp (revision 844f8335f211da19ae4b375761013909a3394d9a)
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
3 // RUN: split-file %s %t
4 
5 // RUN: %clang_cc1 -std=c++20 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %t/main.cpp -o %t/main.o
6 
7 //--- V.h
8 #ifndef V_H
9 #define V_H
10 
11 class A {
12 public:
A()13   constexpr A() { }
~A()14   constexpr ~A() { }
15 };
16 
17 template <typename T>
18 class V {
19 public:
20   V() = default;
21 
V(int n,const A & a=A ())22   constexpr V(int n, const A& a = A()) {}
23 };
24 
25 #endif
26 
27 //--- inst1.h
28 #include "V.h"
29 
inst1()30 static void inst1() {
31   V<int> v;
32 }
33 
34 //--- inst2.h
35 #include "V.h"
36 
inst2()37 static void inst2() {
38   V<int> v(100);
39 }
40 
41 //--- module.modulemap
42 module "M" {
43   export *
44   module "V.h" {
45     export *
46     header "V.h"
47   }
48   module "inst1.h" {
49     export *
50     header "inst1.h"
51   }
52 }
53 
54 module "inst2.h" {
55   export *
56   header "inst2.h"
57 }
58 
59 //--- main.cpp
60 #include "V.h"
61 #include "inst2.h"
62 
63 static void m() {
64   static V<int> v(100);
65 }
66