[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaTemplate / GH71595.cpp
blobdaec9410e547a6b16328e0e78add558fd9a28b4a
1 // RUN: %clang_cc1 -std=c++20 -verify %s
3 template<class T, class U>
4 concept C = true;
6 class non_temp {
7 template<C<non_temp> T>
8 friend void f();
10 non_temp();
13 template<C<non_temp> T>
14 void f() {
15 auto v = non_temp();
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}}
23 temp();
26 template<C<temp<int>> T>
27 void g() {
28 auto v = temp<T>();
31 void h() {
32 f<int>();
33 g<int>();