Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.robertl/eb112.C

raw
1 // { dg-do assemble }
2 template <class STRUCT, class MEMBER> inline STRUCT *
3 setback(MEMBER *bp, MEMBER STRUCT::*offset)
4 {
5 // The implementation of this function may be platform dependend
6 if(!bp) return 0; // NULL pointers remain NULL
7 union { int i; MEMBER STRUCT::*of; } u; // Switch types. Casting won't work.
8 u.of = offset;
9 return (STRUCT *) ((int) bp - u.i);
10 }
11