OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [ext/] [attr-ifunc-3.C] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
/* { dg-do run }  */
2
/* { dg-require-ifunc "" } */
3
/* { dg-options "-Wno-pmf-conversions" } */
4
 
5
#include 
6
 
7
struct Klass
8
{
9
  int implementation ();
10
  int magic ();
11
  static void *resolver ();
12
};
13
 
14
int Klass::implementation (void)
15
{
16
  printf ("'ere I am JH\n");
17
  return 0;
18
}
19
 
20
void *Klass::resolver (void)
21
{
22
  int (Klass::*pmf) () = &Klass::implementation;
23
 
24
  return (void *)(int (*)(Klass *))(((Klass *)0)->*pmf);
25
}
26
 
27
int Klass::magic (void) __attribute__ ((ifunc ("_ZN5Klass8resolverEv")));
28
 
29
int Foo (Klass &obj, int (Klass::*pmf) ())
30
{
31
  return (obj.*pmf) ();
32
}
33
 
34
int main ()
35
{
36
  Klass obj;
37
 
38
  return Foo (obj, &Klass::magic) != 0;
39
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.