2 /* { dg-require-ifunc "" } */
3 /* { dg-options "-Wno-pmf-conversions" } */
12 /* An ifunc resolver must return a pointer to an ordinary (non-member)
13 function. To make it possible to use ifunc with member functions,
14 the resolver must convert a member function pointer to an ordinary
15 function pointer (slicing off the high word). */
16 typedef int Func (Klass*);
18 static Func* resolver ();
21 int Klass::implementation ()
23 __builtin_printf ("'ere I am JH\n");
24 return a[0] + a[1] + a[2] + a[3];
27 Klass::Func* Klass::resolver (void)
29 /* GCC guarantees this conversion to be safe and the resulting pointer
30 usable to call the member function using ordinary (i.e., non-member)
31 function call syntax. */
33 return reinterpret_cast<Func*>(&Klass::implementation);
36 int f (void) __attribute__ ((ifunc ("foo")));
38 typedef int (F)(void);
39 extern "C" F* foo () { return 0; }
42 int Klass::magic () __attribute__ ((ifunc ("_ZN5Klass8resolverEv")));
53 return !(obj.magic () == 10);