c++: P0847R7 (deducing this) - xobj lambdas. [PR102609]
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / concepts-pr67684.C
blob392492214e2b08cd3d74194cfe37d228a35922f6
1 // { dg-do compile { target c++20 } }
2 // { dg-additional-options "-fconcepts-ts" }
4 template<class T>
5 class A {
6  public:
7   template<int I, class S>
8     requires I > 0
9   friend int f1(const A<S>&);
11   template<int I, class S>
12   friend int f2(const A<S>&) requires I > 0;
14  private:
15   int x = 2;
18 template<int I, class S>
19   requires I > 0
20 int f1(const A<S>& a)  { 
21   return a.x;
22
24 template<int I, class S>
25 int f2(const A<S>& a) requires I > 0 { 
26   return a.x;
27
29 class B {
30  public:
31   template<int I>
32     requires I > 0
33   friend int f3(const B&);
35   template<int I>
36   friend int f4(const B&) requires I > 0;
38  private:
39   int x = 2;
42 template<int I>
43   requires I > 0
44 int f3(const B& a) {
45   return a.x;
48 template<int I>
49 int f4(const B& a) requires I > 0 {
50   return a.x;
53 int main() { 
54   A<double> a;
55   f1<2>(a);
56   f2<2>(a);
58   B b;
59   f3<2>(b);
60   f4<2>(b);
62   return 0;