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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [opt/] [ptrmem3.C] - Rev 764

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

// { dg-options "-O1" }

#include <stdio.h>
struct A {
     A(int arg) : ia(arg) {}
     int x,y,z,ia;
     int mf(int arg) { return arg + ia; }
};
int func(int A::*pdm, int (A::*pmf)(int)) //      2.      regular function
{ 
     A oa(2);
     return ((&oa)->*pdm) + (oa.*pmf)(2); 
}       
int main()
{
     int val;

     int A::*pda = &A::ia;           
     int (A::*pmfa)(int) = &A::mf;   
     val = func( pda, pmfa );
     if(val != 6)
       printf("val=%d, expect 6 \n", val);
}

Go to most recent revision | 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.