2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.robertl / eb112.C
blob69ee83c7df5bd6f6077b461d1a7f4aea562d1e0f
1 // { dg-do assemble  }
2 template <class STRUCT, class MEMBER> inline STRUCT *
3 setback(MEMBER *bp, MEMBER STRUCT::*offset)
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);