252
|
1 // RUN: rm -rf %t
|
|
2 // RUN: mkdir %t
|
|
3 // RUN: split-file %s %t
|
|
4 //
|
|
5 // RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm
|
|
6 // RUN: %clang_cc1 -std=c++20 %t/B.cppm -emit-module-interface -o %t/B.pcm
|
|
7 // RUN: %clang_cc1 -std=c++20 %t/use.cppm -fprebuilt-module-path=%t -fsyntax-only -verify
|
|
8
|
|
9 //--- lambda.h
|
|
10 inline auto cmp = [](auto l, auto r) {
|
|
11 return l < r;
|
|
12 };
|
|
13
|
|
14 //--- A.cppm
|
|
15 module;
|
|
16 #include "lambda.h"
|
|
17
|
|
18 export module A;
|
|
19 export auto c1 = cmp;
|
|
20 export using ::cmp;
|
|
21
|
|
22 //--- B.cppm
|
|
23 module;
|
|
24 #include "lambda.h"
|
|
25
|
|
26 export module B;
|
|
27 export auto c2 = cmp;
|
|
28 export using ::cmp;
|
|
29
|
|
30 //--- use.cppm
|
|
31 // expected-no-diagnostics
|
|
32 module;
|
|
33
|
|
34 export module use;
|
|
35
|
|
36 import A;
|
|
37 import B;
|
|
38
|
|
39 static_assert(__is_same(decltype(c1), decltype(c2))); // should succeed.
|
|
40 auto x = cmp; // cmp must not be ambiguous,
|