| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: mkdir -p %t |
| 3 |
// RUN: split-file %s %t |
| 4 |
// |
| 5 |
// RUN: %clang -std=c++20 %t/a.cppm --precompile -o %t/a.pcm \ |
| 6 |
// RUN: -DTEST_INLINE |
| 7 |
// RUN: %clang -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -Xclang -verify \ |
| 8 |
// RUN: -DTEST_INLINE |
| 9 |
// |
| 10 |
// RUN: %clang -std=c++20 %t/a.cppm --precompile -o %t/a.pcm |
| 11 |
// RUN: %clang -std=c++20 %t/test.cc -fprebuilt-module-path=%t -fsyntax-only -Xclang -verify |
| 12 |
|
| 13 |
//--- a.h |
| 14 |
#ifdef TEST_INLINE |
| 15 |
#define INLINE inline |
| 16 |
#else |
| 17 |
#define INLINE |
| 18 |
#endif |
| 19 |
namespace ns { |
| 20 |
template <typename G> static void func() {} |
| 21 |
template <> INLINE void func<long>() {} |
| 22 |
template <typename T = long> void a() { func<T>(); } |
| 23 |
} |
| 24 |
|
| 25 |
//--- a.cppm |
| 26 |
module; |
| 27 |
#include "a.h" |
| 28 |
export module a; |
| 29 |
export using ns::a; |
| 30 |
|
| 31 |
//--- test.cc |
| 32 |
import a; |
| 33 |
auto m = (a(), 0); |
| 34 |
|
| 35 |
#ifdef TEST_INLINE |
| 36 |
// expected-no-diagnostics |
| 37 |
#else |
| 38 |
// [email protected]:9 {{no matching function for call to 'func'}} |
| 39 |
// [email protected]:2 {{in instantiation of function template specialization 'ns::a<long>' requested here}} |
| 40 |
#endif |