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
9 template <typename T
= int>
18 template <template <typename
> typename C
= my_array
>
21 template <typename T
, int *i
= nullptr>
24 template <typename T
, T
*i
= nullptr>
28 template <typename T
, int *i
= &a
>
32 template <typename T
, T
*i
= &b
>
35 template <int T
= (3 > 2)>
38 consteval
int getInt() {
41 template <int T
= getInt()>
45 template <typename T
= double>
52 class others_array
{};
54 template <template <typename
> typename C
= others_array
>
58 consteval
int *getIntPtr() {
61 template <typename T
, int *i
= getIntPtr()>
64 consteval
void *getVoidPtr() {
67 template <typename T
, T
*i
= getVoidPtr()>
71 template <typename T
, int *i
= &a_
>
75 template <typename T
, T
*i
= &b_
>
81 consteval
int getInt2() {
84 template <int T
= getInt2()>
96 // expected-error@foo_bad.h:1 {{template parameter default argument is inconsistent with previous definition}}
97 // expected-note@foo.h:1 {{previous default template argument defined in module foo.<global>}}
98 // expected-error@foo_bad.h:4 {{template parameter default argument is inconsistent with previous definition}}
99 // expected-note@foo.h:4 {{previous default template argument defined in module foo.<global>}}
100 // expected-error@foo_bad.h:10 {{template parameter default argument is inconsistent with previous definition}}
101 // expected-note@foo.h:10 {{previous default template argument defined in module foo.<global>}}
102 // expected-error@foo_bad.h:17 {{template parameter default argument is inconsistent with previous definition}}
103 // expected-note@foo.h:13 {{previous default template argument defined in module foo.<global>}}
104 // expected-error@foo_bad.h:23 {{template parameter default argument is inconsistent with previous definition}}
105 // expected-note@foo.h:16 {{previous default template argument defined in module foo.<global>}}
106 // expected-error@foo_bad.h:27 {{template parameter default argument is inconsistent with previous definition}}
107 // expected-note@foo.h:20 {{previous default template argument defined in module foo.<global>}}
108 // expected-error@foo_bad.h:31 {{template parameter default argument is inconsistent with previous definition}}
109 // expected-note@foo.h:24 {{previous default template argument defined in module foo.<global>}}
110 // expected-error@foo_bad.h:34 {{template parameter default argument is inconsistent with previous definition}}
111 // expected-note@foo.h:27 {{previous default template argument defined in module foo.<global>}}
112 // expected-error@foo_bad.h:40 {{template parameter default argument is inconsistent with previous definition}}
113 // expected-note@foo.h:33 {{previous default template argument defined in module foo.<global>}}