* g++.dg/debug/pr71432.C: Fail on AIX.
[official-gcc.git] / gcc / testsuite / g++.dg / other / offsetof2.C
blob3ab63981d9b35facdd5eb5b5c3eddd590e0f5d6b
1 // { dg-do run }
2 // { dg-options -Wold-style-cast }
4 // Copyright (C) 2003 Free Software Foundation, Inc.
5 // Contributed by Nathan Sidwell 22 Apr 2003 <nathan@codesourcery.com>
7 // DR273 POD can have an operator&, offsetof is still required to work
9 #include <stddef.h>
11 struct POD1
13   int m;
14   
15   void *operator& () const {return 0;} // yes, still a pod!
18 struct POD2 
20   int m;
23 void *operator& (POD2 const &) {return 0;} // ouch!
25 struct POD3 
27   int prefix;
28   
29   POD1 m;
32 struct POD4
34   int prefix;
35   
36   POD1 m;
39 int main ()
41   if (offsetof (POD3, m) != sizeof (int))
42     return 1;
43   if (offsetof (POD4, m) != sizeof (int))
44     return 2;
45   return 0;