blob: e205a2a6a8d5d531a15b65bc536d900e0ef4c202 (
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
30
31
32
33
34
35
36
37
38
|
/* { dg-do run } */
/* { dg-require-ifunc "" } */
/* { dg-options "-Wno-pmf-conversions" } */
#include <stdio.h>
struct Klass
{
int implementation ();
int magic ();
static void *resolver ();
};
int Klass::implementation (void)
{
printf ("'ere I am JH\n");
return 0;
}
void *Klass::resolver (void)
{
int (Klass::*pmf) () = &Klass::implementation;
return (void *)(int (*)(Klass *))(((Klass *)0)->*pmf);
}
int Klass::magic (void) __attribute__ ((ifunc ("_ZN5Klass8resolverEv")));
struct Klassier : Klass
{
};
int main ()
{
Klassier obj;
return obj.magic () != 0;
}
|