Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/concepts-friend2.C

raw
1 // { dg-do compile { target c++20 } }
2
3 template<typename T>
4 concept Eq = requires(T t) { t == t; }; // { dg-message "in requirements" }
5
6 template<Eq T> struct Foo { };
7
8 template<typename T>
9 struct S { // { dg-error "constraint failure" }
10 template<Eq U> friend class Bar;
11
12 friend class Foo<T>;
13 };
14
15 struct X { };
16
17 int main() {
18 S<int> si; // OK
19 S<X> sx;
20 }