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] - Rev 693

Compare with Previous | Blame | View Log

/* { 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")));

int Foo (Klass &obj, int (Klass::*pmf) ())
{
  return (obj.*pmf) ();
}

int main ()
{
  Klass obj;
  
  return Foo (obj, &Klass::magic) != 0;
}

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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