xref: /llvm-project/clang/test/Modules/pr88400.cppm (revision 487967af82053cd08022635a2ff768385d936c80)
1// RUN: rm -rf %t
2// RUN: mkdir -p %t
3// RUN: split-file %s %t
4//
5// RUN: %clang_cc1 -std=c++20 %t/bar.cppm -emit-module-interface -o %t/bar.pcm
6// RUN: %clang_cc1 -std=c++20 %t/foo.cc -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify
7// RUN: %clang_cc1 -std=c++20 %t/bar.cc -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify
8//
9// RUN: %clang_cc1 -std=c++20 %t/bar.cppm -emit-reduced-module-interface -o %t/bar.pcm
10// RUN: %clang_cc1 -std=c++20 %t/foo.cc -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify
11// RUN: %clang_cc1 -std=c++20 %t/bar.cc -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify
12
13//--- header.h
14#pragma once
15
16namespace N {
17    template<typename T>
18    concept X = true;
19
20    template<X T>
21    class Y {
22    public:
23        template<X U>
24        friend class Y;
25    };
26
27    inline Y<int> x;
28}
29
30//--- bar.cppm
31module;
32
33#include "header.h"
34
35export module bar;
36
37namespace N {
38    // To make sure N::Y won't get elided.
39    using N::x;
40}
41
42//--- foo.cc
43// expected-no-diagnostics
44#include "header.h"
45
46import bar;
47
48void y() {
49    N::Y<int> y{};
50};
51
52//--- bar.cc
53// expected-no-diagnostics
54import bar;
55
56#include "header.h"
57
58void y() {
59    N::Y<int> y{};
60};
61
62