aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Modules/hashing-decls-in-exprs-from-gmf.cppm
blob: 8db53c0ace8796971b763d9ceebd11e2fee62936 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/A.cppm -emit-module-interface -o %t/A.pcm
// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/B.cppm -emit-module-interface -o %t/B.pcm
// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/test.cpp -fprebuilt-module-path=%t -fsyntax-only -verify

//--- header.h
#pragma once
template <class _Tp>
class Optional {};

template <class _Tp>
concept C = requires(const _Tp& __t) {
    []<class _Up>(const Optional<_Up>&) {}(__t);
};

//--- func.h
#include "header.h"
template <C T>
void func() {}

//--- duplicated_func.h
#include "header.h"
template <C T>
void duplicated_func() {}

//--- test_func.h
#include "func.h"

void test_func() {
    func<Optional<int>>();
}

//--- test_duplicated_func.h
#include "duplicated_func.h"

void test_duplicated_func() {
    duplicated_func<Optional<int>>();
}

//--- A.cppm
module;
#include "header.h"
#include "test_duplicated_func.h"
export module A;
export using ::test_duplicated_func;

//--- B.cppm
module;
#include "header.h"
#include "test_func.h"
#include "test_duplicated_func.h"
export module B;
export using ::test_func;
export using ::test_duplicated_func;

//--- test.cpp
// expected-no-diagnostics
import A;
import B;

void test() {
    test_func();
    test_duplicated_func();
}