| 1 |
// PR c++/96830 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
template<class T> requires true |
| 5 |
struct A { |
| 6 |
template<class U> friend struct A; // { dg-error "different constraints" } |
| 7 |
template<class U> requires (!!true) friend struct A; // { dg-error "different constraints" } |
| 8 |
}; |
| 9 |
|
| 10 |
template<class T> |
| 11 |
struct B { |
| 12 |
template<class U> requires true friend struct A; |
| 13 |
template<class U> requires true friend struct B; // { dg-error "different constraints" } |
| 14 |
}; |
| 15 |
|
| 16 |
template<class T> concept C = true; |
| 17 |
|
| 18 |
template<C T> |
| 19 |
struct D { |
| 20 |
template<class U> friend struct D; // { dg-error "different constraints" } |
| 21 |
template<C U> friend struct D; |
| 22 |
}; |
| 23 |
|
| 24 |
template struct A<int>; |
| 25 |
template struct B<int>; |
| 26 |
template struct D<int>; |