| 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/test.cpp -fprebuilt-module-path=%t -fsyntax-only -verify |
| 7 |
|
| 8 |
//--- header.h |
| 9 |
#pragma once |
| 10 |
template <class _Tp> |
| 11 |
class Optional {}; |
| 12 |
|
| 13 |
template <class _Tp> |
| 14 |
concept C = requires(const _Tp& __t) { |
| 15 |
[]<class _Up>(const Optional<_Up>&) {}(__t); |
| 16 |
}; |
| 17 |
|
| 18 |
//--- func.h |
| 19 |
#include "header.h" |
| 20 |
template <C T> |
| 21 |
void func() {} |
| 22 |
|
| 23 |
//--- test_func.h |
| 24 |
#include "func.h" |
| 25 |
|
| 26 |
inline void test_func() { |
| 27 |
func<Optional<int>>(); |
| 28 |
} |
| 29 |
|
| 30 |
//--- A.cppm |
| 31 |
module; |
| 32 |
#include "header.h" |
| 33 |
#include "test_func.h" |
| 34 |
export module A; |
| 35 |
export using ::test_func; |
| 36 |
|
| 37 |
//--- test.cpp |
| 38 |
// expected-no-diagnostics |
| 39 |
import A; |
| 40 |
#include "test_func.h" |
| 41 |
|
| 42 |
void test() { |
| 43 |
test_func(); |
| 44 |
} |