Debian Codegraph @

clang/test/Modules/gh110401.cppm

raw
1 // RUN: rm -rf %t
2 // RUN: mkdir %t
3 // RUN: split-file %s %t
4 //
5 // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux -emit-module-interface %t/a.cppm -o %t/A.pcm
6 // RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux -emit-module-interface -fprebuilt-module-path=%t %t/b.cppm -o %t/B.pcm
7
8 // Just check that this doesn't crash.
9
10 //--- a.cppm
11 module;
12
13 template <typename _Visitor>
14 void __do_visit(_Visitor &&__visitor) {
15 using _V0 = int;
16 [](_V0 __v) -> _V0 { return __v; } (1);
17 }
18
19 export module A;
20
21 void g() {
22 struct Visitor { };
23 __do_visit(Visitor());
24 }
25
26 //--- b.cppm
27 module;
28
29 template <typename _Visitor>
30 void __do_visit(_Visitor &&__visitor) {
31 using _V0 = int;
32
33 // Check that we instantiate this lambda's call operator in 'f' below
34 // instead of the one in 'a.cppm' here; otherwise, we won't find a
35 // corresponding instantiation of the using declaration above.
36 [](_V0 __v) -> _V0 { return __v; } (1);
37 }
38
39 export module B;
40 import A;
41
42 void f() {
43 __do_visit(1);
44 }