3 // RUN: split-file %s %t
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
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
12 template <typename T
= int>
21 template <template <typename
> typename C
= my_array
>
24 template <typename T
, int *i
= nullptr>
27 template <typename T
, T
*i
= nullptr>
31 template <typename T
, int *i
= &a
>
35 template <typename T
, T
*i
= &b
>
38 template <int T
= (3 > 2)>
41 consteval
int getInt() {
44 template <int T
= getInt()>
48 template <typename T
= double>
55 class others_array
{};
57 template <template <typename
> typename C
= others_array
>
61 consteval
int *getIntPtr() {
64 template <typename T
, int *i
= getIntPtr()>
67 consteval
void *getVoidPtr() {
70 template <typename T
, T
*i
= getVoidPtr()>
74 template <typename T
, int *i
= &a_
>
78 template <typename T
, T
*i
= &b_
>
84 consteval
int getInt2() {
87 template <int T
= getInt2()>
96 export
using ::my_array
;
109 // expected-error@foo_bad.h:1 {{template parameter default argument is inconsistent with previous definition}}
110 // expected-note@foo.h:1 {{previous default template argument defined in module foo.<global>}}
111 // expected-error@foo_bad.h:4 {{template parameter default argument is inconsistent with previous definition}}
112 // expected-note@foo.h:4 {{previous default template argument defined in module foo.<global>}}
113 // expected-error@foo_bad.h:10 {{template parameter default argument is inconsistent with previous definition}}
114 // expected-note@foo.h:10 {{previous default template argument defined in module foo.<global>}}
115 // expected-error@foo_bad.h:17 {{template parameter default argument is inconsistent with previous definition}}
116 // expected-note@foo.h:13 {{previous default template argument defined in module foo.<global>}}
117 // expected-error@foo_bad.h:23 {{template parameter default argument is inconsistent with previous definition}}
118 // expected-note@foo.h:16 {{previous default template argument defined in module foo.<global>}}
119 // expected-error@foo_bad.h:27 {{template parameter default argument is inconsistent with previous definition}}
120 // expected-note@foo.h:20 {{previous default template argument defined in module foo.<global>}}
121 // expected-error@foo_bad.h:31 {{template parameter default argument is inconsistent with previous definition}}
122 // expected-note@foo.h:24 {{previous default template argument defined in module foo.<global>}}
123 // expected-error@foo_bad.h:34 {{template parameter default argument is inconsistent with previous definition}}
124 // expected-note@foo.h:27 {{previous default template argument defined in module foo.<global>}}
125 // expected-error@foo_bad.h:40 {{template parameter default argument is inconsistent with previous definition}}
126 // expected-note@foo.h:33 {{previous default template argument defined in module foo.<global>}}