| 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 |
struct Nt { |
| 7 |
template<Eq T> friend void f(T) { } |
| 8 |
} nt; |
| 9 |
|
| 10 |
template<typename T> struct S; |
| 11 |
|
| 12 |
template<Eq T> |
| 13 |
void proc(S<T>*); |
| 14 |
|
| 15 |
template<typename T> |
| 16 |
struct S { |
| 17 |
friend bool operator==(S, S) requires Eq<T> { return true; } |
| 18 |
|
| 19 |
friend void proc<>(S*); // { dg-error "does not match any template declaration" } |
| 20 |
}; |
| 21 |
|
| 22 |
struct X { } x; |
| 23 |
|
| 24 |
int main() { |
| 25 |
// f(0); // OK |
| 26 |
f(nt); // { dg-error "" } |
| 27 |
f(x); // { dg-error "3:'f' was not declared" } |
| 28 |
|
| 29 |
S<int> si; |
| 30 |
si == si; // OK |
| 31 |
|
| 32 |
S<X> sx; |
| 33 |
sx == sx; // { dg-error "no match" } |
| 34 |
} |