| 1 |
// PR c++/22621 |
| 2 |
|
| 3 |
struct foo { |
| 4 |
typedef int (*fun)(int); |
| 5 |
|
| 6 |
static int f(int); // overload between static & non-static |
| 7 |
int f(); |
| 8 |
|
| 9 |
static int g(int); // non-overloaded static |
| 10 |
}; |
| 11 |
|
| 12 |
template<foo::fun> |
| 13 |
struct f_obj { |
| 14 |
// something .. |
| 15 |
}; |
| 16 |
|
| 17 |
f_obj<&foo::f> a; // OK |
| 18 |
f_obj<foo::f> b; // OK (note: a and b are of the same type) |
| 19 |
|
| 20 |
int foo::f() |
| 21 |
{ |
| 22 |
f_obj<&foo::f> a; // OK |
| 23 |
f_obj<foo::f> b; // ERROR: foo::f cannot be a constant expression |
| 24 |
|
| 25 |
f_obj<&foo::g> c; // OK |
| 26 |
f_obj<foo::g> d; // OK |
| 27 |
return 0; |
| 28 |
} |
| 29 |
|