1 // Contributed by Dodji Seketeli <dodji@redhat.com>
2 // Origin PR c++/37093
3 
4 template <class C, void (C::*M) ()>
5 static
foo(void * obj)6 void foo(void *obj)
7 {
8   C *p = static_cast<C*>(obj);
9   (p->*M)();
10 }
11 
12 template <class C>
13 static void
bar(C * c,void (C::* m)())14 bar(C *c, void (C::*m) ())
15 {
16   foo<C,m>((void *)c);// { dg-error "(not a valid template arg|pointer-to-member|no matching fun|could not convert|constant)" }
17 }
18 
19 struct S
20 {
bazS21   void baz () {}
22 };
23 
24 int
main()25 main ()
26 {
27   S a;
28   bar(&a, &S::baz);
29 }
30