gcc/testsuite/g++.dg/other/offsetof8.C
raw| 1 | // PR c++/68711 - [5 regression] SEGV on an invalid offsetof of a member |
| 2 | // of a virtual base |
| 3 | // { dg-do compile } |
| 4 | |
| 5 | struct A { int i; }; |
| 6 | |
| 7 | struct B: virtual A { }; |
| 8 | |
| 9 | int a[] = { |
| 10 | !&((B*)0)->i, // { dg-error "invalid access to non-static data member" } |
| 11 | __builtin_offsetof (B, i) // { dg-error "invalid access to non-static" } |
| 12 | }; |