aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/concepts-friend14.C
blob: f46c7e4bdfb3bc69cb8afc0591faab9d84204a57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// PR c++/96830
// { dg-do compile { target c++20 } }

template<class T> requires true
struct A {
  template<class U> friend struct A;                   // { dg-error "different constraints" }
  template<class U> requires (!!true) friend struct A; // { dg-error "different constraints" }
};

template<class T>
struct B {
  template<class U> requires true friend struct A;
  template<class U> requires true friend struct B; // { dg-error "different constraints" }
};

template<class T> concept C = true;

template<C T>
struct D {
  template<class U> friend struct D; // { dg-error "different constraints" }
  template<C U> friend struct D;
};

template struct A<int>;
template struct B<int>;
template struct D<int>;