131
|
1 // { dg-do compile { target c++17 } }
|
|
2 // { dg-options "-fconcepts" }
|
111
|
3
|
|
4 template<typename T>
|
|
5 concept bool Eq() { return requires(T t) { t == t; }; }
|
|
6
|
|
7 struct Nt {
|
|
8 template<Eq T> friend void f(T) { }
|
|
9 } nt;
|
|
10
|
|
11 template<typename T> struct S;
|
|
12
|
|
13 template<Eq T>
|
|
14 void proc(S<T>*);
|
|
15
|
|
16 template<typename T>
|
|
17 struct S {
|
|
18 friend bool operator==(S, S) requires Eq<T>() { return true; }
|
|
19
|
|
20 friend void proc<>(S*); // { dg-error "does not match any template declaration" }
|
|
21 };
|
|
22
|
|
23 struct X { } x;
|
|
24
|
|
25 int main() {
|
|
26 // f(0); // OK
|
|
27 f(nt); // { dg-error "cannot call" }
|
|
28 f(x); // { dg-error "3:'f' was not declared" }
|
|
29
|
|
30 S<int> si;
|
|
31 si == si; // OK
|
|
32
|
|
33 S<X> sx;
|
|
34 sx == sx; // { dg-error "no match" }
|
|
35 }
|