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