| 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 |
|
| 16 |
namespace 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 |
| 31 |
module; |
| 32 |
|
| 33 |
#include "header.h" |
| 34 |
|
| 35 |
export module bar; |
| 36 |
|
| 37 |
namespace 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 |
|
| 46 |
import bar; |
| 47 |
|
| 48 |
void y() { |
| 49 |
N::Y<int> y{}; |
| 50 |
}; |
| 51 |
|
| 52 |
//--- bar.cc |
| 53 |
// expected-no-diagnostics |
| 54 |
import bar; |
| 55 |
|
| 56 |
#include "header.h" |
| 57 |
|
| 58 |
void y() { |
| 59 |
N::Y<int> y{}; |
| 60 |
}; |
| 61 |
|