1// { dg-do run } 2// { dg-options -Wold-style-cast } 3 4// Copyright (C) 2003 Free Software Foundation, Inc. 5// Contributed by Nathan Sidwell 22 Apr 2003 <nathan@codesourcery.com> 6 7// DR273 POD can have an operator&, offsetof is still required to work 8 9#include <stddef.h> 10 11struct POD1 12{ 13 int m; 14 15 void *operator& () const {return 0;} // yes, still a pod! 16}; 17 18struct POD2 19{ 20 int m; 21}; 22 23void *operator& (POD2 const &) {return 0;} // ouch! 24 25struct POD3 26{ 27 int prefix; 28 29 POD1 m; 30}; 31 32struct POD4 33{ 34 int prefix; 35 36 POD1 m; 37}; 38 39int main () 40{ 41 if (offsetof (POD3, m) != sizeof (int)) 42 return 1; 43 if (offsetof (POD4, m) != sizeof (int)) 44 return 2; 45 return 0; 46} 47 48