Debian Codegraph @

clang/test/Modules/hashing-decls-in-exprs-from-gmf.cppm

raw
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
4 //
5 // RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/A.cppm -emit-module-interface -o %t/A.pcm
6 // RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/B.cppm -emit-module-interface -o %t/B.pcm
7 // RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/test.cpp -fprebuilt-module-path=%t -fsyntax-only -verify
8
9 //--- header.h
10 #pragma once
11 template <class _Tp>
12 class Optional {};
13
14 template <class _Tp>
15 concept C = requires(const _Tp& __t) {
16 []<class _Up>(const Optional<_Up>&) {}(__t);
17 };
18
19 //--- func.h
20 #include "header.h"
21 template <C T>
22 void func() {}
23
24 //--- duplicated_func.h
25 #include "header.h"
26 template <C T>
27 void duplicated_func() {}
28
29 //--- test_func.h
30 #include "func.h"
31
32 void test_func() {
33 func<Optional<int>>();
34 }
35
36 //--- test_duplicated_func.h
37 #include "duplicated_func.h"
38
39 void test_duplicated_func() {
40 duplicated_func<Optional<int>>();
41 }
42
43 //--- A.cppm
44 module;
45 #include "header.h"
46 #include "test_duplicated_func.h"
47 export module A;
48 export using ::test_duplicated_func;
49
50 //--- B.cppm
51 module;
52 #include "header.h"
53 #include "test_func.h"
54 #include "test_duplicated_func.h"
55 export module B;
56 export using ::test_func;
57 export using ::test_duplicated_func;
58
59 //--- test.cpp
60 // expected-no-diagnostics
61 import A;
62 import B;
63
64 void test() {
65 test_func();
66 test_duplicated_func();
67 }