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-4.C] - Blame information for rev 693

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
  virtual int magic () = 0;
10
};
11
 
12
struct Klassier : Klass
13
{
14
  int implementation ();
15
  int magic ();
16
  static void *resolver ();
17
};
18
 
19
int Klassier::implementation (void)
20
{
21
  printf ("'ere I am JH\n");
22
  return 0;
23
}
24
 
25
void *Klassier::resolver (void)
26
{
27
  int (Klassier::*pmf) () = &Klassier::implementation;
28
 
29
  return (void *)(int (*)(Klassier *))(((Klassier *)0)->*pmf);
30
}
31
 
32
int Klassier::magic (void) __attribute__ ((ifunc ("_ZN8Klassier8resolverEv")));
33
 
34
int __attribute__ ((weak)) Foo (Klass &base)
35
{
36
  return base.magic ();
37
}
38
 
39
int main ()
40
{
41
  Klassier obj;
42
 
43
  return Foo (obj) != 0;
44
}

powered by: WebSVN 2.1.0

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