aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Modules/pr145975.cppm
blob: 792c4ad811a156b99b226fc01b40cd30b417da6d (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
58
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t

// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm \
// RUN:     -fmodule-file=a:b=%t/b.pcm
// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -o %t/c.pcm \
// RUN:     -fmodule-file=a:b=%t/b.pcm -fmodule-file=a=%t/a.pcm

// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -o %t/b.pcm
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm \
// RUN:     -fmodule-file=a:b=%t/b.pcm
// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-reduced-module-interface -o %t/c.pcm \
// RUN:     -fmodule-file=a:b=%t/b.pcm -fmodule-file=a=%t/a.pcm


//--- b.cppm
export module a:b;
class Polymorphic {
public:
    virtual ~Polymorphic() = default;
};

//--- a.h
namespace std {
using X = int;
}

namespace a {
    using std::X;
}

//--- a.cppm
module;
#include "a.h"
export module a;
import :b;
std::X var;
namespace std {
    export using std::X;
}
namespace a {
    export using std::X;
}

//--- c.cppm
export module c;
import a;
namespace a {
    export using std::X;
}

namespace a {
    X test() {
        return X{};
    }
}