brintos

brintos / llvm-project-archived public Read only

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