1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++2c %s
8 template <typename
> struct TS
{};
10 template <typename
...Pack
>
13 static void f() { } // expected-note {{declared private here}}
18 static void g() { } // expected-note {{declared private here}}
44 X
<A
, B
, C
>::f(); // expected-error {{'f' is a private member of 'X<A, B, C>'}}
45 Y::g(); // expected-error {{'g' is a private member of 'Y'}}
56 template <typename
...Pack
>
58 template <template <typename
> class Template
>
60 friend Template
<Pack
>...;
66 Z
<int, long, char>::Inner
<TS
> inner
;
69 namespace p2893r3_examples
{
73 Passkey() {} // expected-note {{declared private here}}
82 void f(Passkey
<Foo
, Bar
, Baz
>);
86 Foo() { C c
; c
.f({}); }
90 Bar() { C c
; c
.f({}); }
94 Baz() { C c
; c
.f({}); }
98 Quux() { C c
; c
.f({}); } // expected-error {{calling a private constructor of class 'p2893r3_examples::Passkey<p2893r3_examples::Foo, p2893r3_examples::Bar, p2893r3_examples::Baz>'}}
101 template<class Derived
, class MsgT
>
104 static_cast<Derived
*>(this)->private_
+= 1;
108 template<class... MsgTs
>
109 struct Dispatcher
: Receiver
<Dispatcher
<MsgTs
...>, MsgTs
>... {
110 using Receiver
<Dispatcher
, MsgTs
>::receive
...;
111 friend Receiver
<Dispatcher
, MsgTs
>...;
118 Dispatcher
<int, float> d
;
122 } // namespace p2893r3_examples
124 namespace p2893r3_note
{
125 template <class... Ts
> class R
{
129 template <class... Ts
, class... Us
>
130 class R
<R
<Ts
...>, R
<Us
...>> {
131 friend Ts::Nested
..., Us
...;
134 struct E
{ struct Nested
; };
135 R
<R
<E
>, R
<C
, int>> rr
;
136 } // namespace p2893r3_note
138 namespace template_template
{
139 template <typename U
, template <typename
> typename
... Friend
>
141 friend class Friend
<U
>...;
142 static constexpr int a
= 42;
145 template <typename U
>
147 static_assert(S
<U
, T
>::a
== 42);
148 static_assert(S
<U
, T
>::a
== 43); // expected-error {{static assertion failed due to requirement 'S<int, template_template::T>::a == 43'}} \
149 // expected-note {{expression evaluates to '42 == 43'}}
153 T
<int> t
; // expected-note {{in instantiation of}}