| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: mkdir %t |
| 3 |
// RUN: split-file %s %t |
| 4 |
// |
| 5 |
// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -I%t -emit-module-interface -o %t/foo.pcm |
| 6 |
// RUN: %clang_cc1 -fprebuilt-module-path=%t -std=c++20 %t/use.cpp -I%t -fsyntax-only -verify |
| 7 |
|
| 8 |
// RUN: %clang_cc1 -std=c++20 %t/foo.cppm -I%t -emit-reduced-module-interface -o %t/foo.pcm |
| 9 |
// RUN: %clang_cc1 -fprebuilt-module-path=%t -std=c++20 %t/use.cpp -I%t -fsyntax-only -verify |
| 10 |
|
| 11 |
//--- foo.h |
| 12 |
template <typename T> |
| 13 |
T u; |
| 14 |
|
| 15 |
template <typename T = int> |
| 16 |
T v; |
| 17 |
|
| 18 |
template <int T = 8> |
| 19 |
int v2; |
| 20 |
|
| 21 |
template <typename T> |
| 22 |
class my_array {}; |
| 23 |
|
| 24 |
template <template <typename> typename C = my_array> |
| 25 |
int v3; |
| 26 |
|
| 27 |
template <typename T, int *i = nullptr> |
| 28 |
T v4; |
| 29 |
|
| 30 |
template <typename T, T *i = nullptr> |
| 31 |
T v5; |
| 32 |
|
| 33 |
inline int a = 43; |
| 34 |
template <typename T, int *i = &a> |
| 35 |
T v6; |
| 36 |
|
| 37 |
inline int b = 43; |
| 38 |
template <typename T, T *i = &b> |
| 39 |
T v7; |
| 40 |
|
| 41 |
template <int T = (3 > 2)> |
| 42 |
int v8; |
| 43 |
|
| 44 |
consteval int getInt() { |
| 45 |
return 55; |
| 46 |
} |
| 47 |
template <int T = getInt()> |
| 48 |
int v9; |
| 49 |
|
| 50 |
//--- foo.cppm |
| 51 |
module; |
| 52 |
#include "foo.h" |
| 53 |
export module foo; |
| 54 |
|
| 55 |
|
| 56 |
//--- use.cpp |
| 57 |
// expected-no-diagnostics |
| 58 |
import foo; |
| 59 |
#include "foo.h" |