| 1 |
// { dg-do compile { target c++17 } } |
| 2 |
// { dg-options "-fconcepts" } |
| 3 |
|
| 4 |
template<typename T> |
| 5 |
concept Class = __is_class(T); |
| 6 |
|
| 7 |
template<Class T> void f(T) { } |
| 8 |
|
| 9 |
template<typename T> void fn(T) { } |
| 10 |
|
| 11 |
auto p1 = &f<int>; // { dg-error "" } |
| 12 |
void (*p2)(int) = &f<int>; // { dg-error "no matches" } |
| 13 |
void (*p3)(int) = &f; // { dg-error "no matches" } |
| 14 |
|
| 15 |
struct S { |
| 16 |
template<Class T> int f(T) { return 0; } |
| 17 |
}; |
| 18 |
|
| 19 |
auto p4 = &S::template f<int>; // { dg-error "" } |
| 20 |
int (S::*p6)(int) = &S::template f<int>; // { dg-error "no matches" } |
| 21 |
int (S::*p7)(int) = &S::f; // { dg-error "no matches" } |
| 22 |
|
| 23 |
template<typename T> |
| 24 |
void g(T x) { } |
| 25 |
|
| 26 |
int main () { |
| 27 |
g(&f<int>); // { dg-error "no match" } |
| 28 |
} |