| 1 |
// PR c++/119233 |
| 2 |
// A version of fn-ptr3a.C using member instead of non-member function |
| 3 |
// pointers. |
| 4 |
|
| 5 |
struct B { |
| 6 |
template<class T> |
| 7 |
void f(T) { T::fail; } // { dg-error "fail" } |
| 8 |
}; |
| 9 |
|
| 10 |
template<void (B::*P)(int)> |
| 11 |
struct A { |
| 12 |
// P not called |
| 13 |
}; |
| 14 |
|
| 15 |
template<void (B::*P)(char)> |
| 16 |
void wrap() { |
| 17 |
// P not called |
| 18 |
} |
| 19 |
|
| 20 |
template<int> |
| 21 |
void g() { |
| 22 |
A<&B::f> a; // { dg-message "required from" } |
| 23 |
wrap<&B::f>(); // { dg-message "required from" } |
| 24 |
} |
| 25 |
|
| 26 |
int main() { |
| 27 |
g<0>(); |
| 28 |
} |