2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / opt / ptrmem3.C
blob552a92c9c1a7406617785cfc0be7959f537b6cfc
1 // { dg-options "-O1" }
3 #include <stdio.h>
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()
16      int val;
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);