aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/other/ptrmem10.C
blob: ff8c8434115b72a1936379b2d1b75662debe7ba5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Contributed by Dodji Seketeli <dodji@redhat.com>
// Origin PR c++/37093

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);// { dg-error "(not a valid template arg|pointer-to-member|no matching fun|could not convert|constant)" }
}

struct S
{
  void baz () {}
};

int
main ()
{
  S a;
  bar(&a, &S::baz);
}