OSDN Git Service

Pizza-lize :-)
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / other / ptrmem10.C
1 // Contributed by Dodji Seketeli <dodji@redhat.com>
2 // Origin PR c++/37093
3
4 template <class C, void (C::*M) ()>
5 static
6 void foo(void *obj)             // { dg-message "note" }
7 {
8   C *p = static_cast<C*>(obj);
9   (p->*M)();
10 }
11
12 template <class C>
13 static void
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)" }
17   // { dg-message "candidate" "candidate note" { target *-*-* } 16 }
18 }
19
20 struct S
21 {
22   void baz () {}
23 };
24
25 int
26 main ()
27 {
28   S a;
29   bar(&a, &S::baz);
30 }