gcc/testsuite/g++.dg/other/offsetof3.C
raw| 1 | /* Verify that offsetof complains if given a non-standard-layout class. */ |
| 2 | /* Copyright (C) 2003 Free Software Foundation, Inc. */ |
| 3 | /* Contributed by Matt Austern <[email protected]> 15 May 2003 */ |
| 4 | |
| 5 | struct X |
| 6 | { |
| 7 | int x, y; |
| 8 | protected: |
| 9 | int z; |
| 10 | }; |
| 11 | |
| 12 | typedef X* pX; |
| 13 | typedef __SIZE_TYPE__ size_t; |
| 14 | |
| 15 | size_t yoff = __builtin_offsetof (X, y); /* { dg-message "35:non-standard-layout" } */ |