1 // RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s
4 template<typename Ty
= int>
5 friend void foo(auto){}
7 template<typename Ty
= int, typename Tz
>
13 template<typename Ty
= int>
14 friend void foo3(auto){}
16 template<typename Ty
= int, typename Tz
>
23 // expected-error@+2{{template parameter missing a default argument}}
24 // expected-note@+1{{previous default template argument defined here}}
25 template<typename T
= int, typename U
>
28 struct HasFriendClassTempl
{
29 // expected-error@+1{{default template argument not permitted on a friend template}}
30 template<typename T
= int, typename U
>
33 // expected-error@+3{{cannot define a type in a friend declaration}}
34 // expected-error@+1{{default template argument not permitted on a friend template}}
35 template<typename T
= int, typename U
>
36 friend struct Friend2
{};
40 struct HasFriendClassTempl2
{
41 // expected-error@+3{{template parameter missing a default argument}}
42 // expected-note@+2{{previous default template argument defined here}}
43 // expected-note@#INST2{{in instantiation of template class}}
44 template<typename T
= int, typename U
>
49 HasFriendClassTempl2
<int>(); // #INST2
52 // expected-error@+2{{template parameter missing a default argument}}
53 // expected-note@+1{{previous default template argument defined here}}
54 template<typename T
= int, typename U
>
55 static constexpr U VarTempl
;
57 // expected-error@+2{{template parameter missing a default argument}}
58 // expected-note@+1{{previous default template argument defined here}}
59 template<typename T
= int, typename U
>