xref: /llvm-project/clang/test/SemaTemplate/GH71595.cpp (revision 46a395d8c41f6009a7fbae51f408c3c6ea2399d3)
1 // RUN: %clang_cc1 -std=c++20 -verify %s
2 
3 template<class T, class U>
4 concept C = true;
5 
6 class non_temp {
7     template<C<non_temp> T>
8     friend void f();
9 
10     non_temp();
11 };
12 
13 template<C<non_temp> T>
f()14 void f() {
15     auto v = non_temp();
16 }
17 
18 template<class A>
19 class temp {
20     template<C<temp> T>
21     friend void g(); // expected-error {{friend declaration with a constraint that depends on an enclosing template parameter must be a definition}}
22 
23     temp();
24 };
25 
26 template<C<temp<int>> T>
g()27 void g() {
28     auto v = temp<T>();
29 }
30 
h()31 void h() {
32     f<int>();
33     g<int>();
34 }
35