PR middle-end/77674
[official-gcc.git] / gcc / testsuite / g++.dg / other / ptrmem10.C
blobff8c8434115b72a1936379b2d1b75662debe7ba5
1 // Contributed by Dodji Seketeli <dodji@redhat.com>
2 // Origin PR c++/37093
4 template <class C, void (C::*M) ()>
5 static
6 void foo(void *obj)
8   C *p = static_cast<C*>(obj);
9   (p->*M)();
12 template <class C>
13 static void
14 bar(C *c, void (C::*m) ())
16   foo<C,m>((void *)c);// { dg-error "(not a valid template arg|pointer-to-member|no matching fun|could not convert|constant)" }
19 struct S
21   void baz () {}
24 int
25 main ()
27   S a;
28   bar(&a, &S::baz);