blob: d064cdfe3eb73bb20032698bee226854235dcb61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/mod2.cppm -emit-module-interface -o %t/mod2.pcm
// RUN: %clang_cc1 -std=c++20 %t/mod1.cppm -emit-module-interface -o %t/mod1.pcm \
// RUN: -fmodule-file=Mod2=%t/mod2.pcm
// RUN: %clang_cc1 -std=c++20 %t/test.cc -fmodule-file=Mod2=%t/mod2.pcm -fmodule-file=Mod=%t/mod1.pcm \
// RUN: -fsyntax-only -verify
// RUN: %clang_cc1 -std=c++20 %t/mod2.cppm -emit-module-interface -o %t/mod2.pcm
// RUN: %clang_cc1 -std=c++20 %t/mod1.cppm -emit-module-interface -o %t/mod1.pcm \
// RUN: -fmodule-file=Mod2=%t/mod2.pcm
// RUN: %clang_cc1 -std=c++20 %t/mod1.pcm -fmodule-file=Mod2=%t/mod2.pcm -emit-llvm -o - \
// RUN: | FileCheck %t/mod1.cppm
//--- hello.h
template <typename V> int get() noexcept {return 0;};
template <typename T>
class List
{
template <typename V> friend int get() noexcept;
};
//--- mod2.cppm
module;
#include "hello.h"
export module Mod2;
export const char *modFn2() {
List<int> a;
return "hello";
}
//--- mod1.cppm
module;
#include "hello.h"
export module Mod;
import Mod2;
export extern "C" const char *modFn() {
List<int> a;
List<double> b;
return modFn2();
}
// Fine enough to check it won't crash.
// CHECK: define {{.*}}@modFn
//--- test.cc
// expected-no-diagnostics
import Mod;
import Mod2;
void test() {
modFn();
modFn2();
}
|