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 //--- foo.h
9 template <typename T>
10 T u;
11 
12 template <typename T = int>
13 T v;
14 
15 template <int T = 8>
16 int v2;
17 
18 template <typename T>
19 class my_array {};
20 
21 template <template <typename> typename C = my_array>
22 int v3;
23 
24 template <typename T, int *i = nullptr>
25 T v4;
26 
27 template <typename T, T *i = nullptr>
28 T v5;
29 
30 inline int a = 43;
31 template <typename T, int *i = &a>
32 T v6;
33 
34 inline int b = 43;
35 template <typename T, T *i = &b>
36 T v7;
37 
38 template <int T = (3 > 2)>
39 int v8;
40 
getInt()41 consteval int getInt() {
42   return 55;
43 }
44 template <int T = getInt()>
45 int v9;
46 
47 //--- foo.cppm
48 module;
49 #include "foo.h"
50 export module foo;
51 
52 
53 //--- use.cpp
54 // expected-no-diagnostics
55 import foo;
56 #include "foo.h"
57