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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [g++.dg/] [opt/] [ptrmem3.C] - Blame information for rev 313

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

Line No. Rev Author Line
1 301 jeremybenn
// { dg-options "-O1" }
2
 
3
#include 
4
struct A {
5
     A(int arg) : ia(arg) {}
6
     int x,y,z,ia;
7
     int mf(int arg) { return arg + ia; }
8
};
9
int func(int A::*pdm, int (A::*pmf)(int)) //      2.      regular function
10
{
11
     A oa(2);
12
     return ((&oa)->*pdm) + (oa.*pmf)(2);
13
}
14
int main()
15
{
16
     int val;
17
 
18
     int A::*pda = &A::ia;
19
     int (A::*pmfa)(int) = &A::mf;
20
     val = func( pda, pmfa );
21
     if(val != 6)
22
       printf("val=%d, expect 6 \n", val);
23
}

powered by: WebSVN 2.1.0

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