summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.pt/local7.C
blob: 96b19fc64c9f061cac69eb188a482848c562b69b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// { dg-do assemble  }

template <class STRUCT, class MEMBER> inline STRUCT *
setback(MEMBER *bp, MEMBER STRUCT::*offset)
{
        if(!bp) return 0;
        union { int i; MEMBER STRUCT::*of; } u;
        u.of = offset;
        return (STRUCT *) ((__SIZE_TYPE__) bp - u.i);
}
 

struct S
{
  int i;
};

int main()
{
  S s;

  S* sp = setback (&s.i, &S::i);
}