aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Modules/gh110401.cppm
blob: 6b335eb5ba9d556e8acba1cc24bd14c21ddfa415 (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
// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 -triple x86_64-unknown-linux -emit-module-interface %t/a.cppm -o %t/A.pcm
// 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

// Just check that this doesn't crash.

//--- a.cppm
module;

template <typename _Visitor>
void __do_visit(_Visitor &&__visitor) {
  using _V0 = int;
  [](_V0 __v) -> _V0 { return __v; } (1);
}

export module A;

void g() {
  struct Visitor { };
  __do_visit(Visitor());
}

//--- b.cppm
module;

template <typename _Visitor>
void __do_visit(_Visitor &&__visitor) {
  using _V0 = int;

  // Check that we instantiate this lambda's call operator in 'f' below
  // instead of the one in 'a.cppm' here; otherwise, we won't find a
  // corresponding instantiation of the using declaration above.
  [](_V0 __v) -> _V0 { return __v; } (1);
}

export module B;
import A;

void f() {
  __do_visit(1);
}