blob: c51483b8428dd46ba43a9a307477c858b81c8aab [file] [log] [blame]
Jonas Hahnfeld99b54742023-08-01 18:31:51 +02001// RUN: rm -rf %t
2// RUN: mkdir %t
3// RUN: split-file %s %t
4
5// RUN: %clang_cc1 -emit-obj -fmodules -fimplicit-module-maps -fmodules-cache-path=%t %t/merge.cpp -o %t/merge.o
6
7//--- V.h
8#ifndef V_H
9#define V_H
10template <typename T>
11struct V {
12 ~V() {}
13};
14#endif
15
16//--- A.h
17#include "V.h"
18
19void A(const V<unsigned long> &v);
20
21//--- B.h
22#include "V.h"
23
24inline V<unsigned long> B() {
25 return {};
26}
27
28//--- C.h
29#include "V.h"
30
31#include "A.h"
32
33class C {
34public:
35 C(const V<unsigned long> &v) {
36 V<unsigned long> v2;
37 }
38};
39
40C GetC() {
41 return {{}};
42}
43
44// This include *MUST* come last.
45#include "B.h"
46
47//--- module.modulemap
48module "V" { header "V.h" export * }
49module "A" { header "A.h" export * }
50module "B" { header "B.h" export * }
51module "C" { header "C.h" export * }
52
53//--- merge.cpp
54#include "C.h"
55
56template <typename T>
57C GetC_main() {
58 return {{}};
59}
60
61void f() {
62 GetC_main<float>();
63 GetC();
64}