PR c/82301 - Updated test case g++.dg/ext/attr-ifunc-1.C (and others) in r253041...
[official-gcc.git] / gcc / testsuite / g++.dg / ext / attr-ifunc-2.C
blobe5be3d29aba096f1cb7414966a91db7833330899
1 /* { dg-do run }  */
2 /* { dg-require-ifunc "" } */
3 /* { dg-options "-Wno-pmf-conversions" } */
5 #include <stdio.h>
7 struct Klass
9   int implementation ();
10   int magic ();
12   typedef int Func (Klass*);
14   static Func* resolver ();
17 int Klass::implementation (void)
19   printf ("'ere I am JH\n");
20   return 0;
23 Klass::Func* Klass::resolver (void)
25   /* GCC guarantees this conversion to be safe and the resulting pointer
26      usable to call the member function using ordinary (i.e., non-member)
27      function call syntax.  */
29   return reinterpret_cast<Func*>(&Klass::implementation);
32 int Klass::magic (void) __attribute__ ((ifunc ("_ZN5Klass8resolverEv")));
34 struct Klassier : Klass
38 int main ()
40   Klassier obj;
42   return obj.magic () != 0;