template <class C, void (C::*M) ()> static void foo (void *obj) { C *p = static_cast<C*> (obj); (p->*M) (); }
template <class C> static void bar (C *c, void (C::*m) ()) { foo<C, m> ((void *) c); } struct S { void baz () {} }; int main () { S a; bar (&a, &S::baz); } ICEs since 4.0 (in 3.4 and before before it gave rh458297.C: In function `void bar(C*, void (C::*)()) [with C = S]': rh458297.C:23: instantiated from here rh458297.C:11: error: `m' is not a valid template argument rh458297.C:11: error: it must be a pointer-to-member of the form `&X::Y' rh458297.C:11: error: no matching function for call to `foo(void*)' ). -- Summary: [4.2/4.3/4.4 Regression] ICE with pointer to member template parameters Product: gcc Version: 4.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37093