PR c++/86728 - C variadic generic lambda.
[official-gcc.git] / gcc / testsuite / g++.dg / concepts / friend1.C
blobc437c79d01fbb0d75ed5c5e8805f0779e2c6ffed
1 // { dg-options "-std=c++17 -fconcepts" }
3 template<typename T>
4   concept bool Eq() { return requires(T t) { t == t; }; }
6 struct Nt {
7   template<Eq T> friend void f(T) { }
8 } nt;
10 template<typename T> struct S;
12 template<Eq T>
13   void proc(S<T>*);
15 template<typename T>
16   struct S {
17     friend bool operator==(S, S) requires Eq<T>() { return true; }
19     friend void proc<>(S*); // { dg-error "does not match any template declaration" }
20   };
22 struct X { } x;
24 int main() {
25   // f(0); // OK
26   f(nt); // { dg-error "cannot call" }
27   f(x);  // { dg-error "3:'f' was not declared" }
29   S<int> si;
30   si == si; // OK
32   S<X> sx;
33   sx == sx; // { dg-error "no match" }