PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / c99-const-expr-9.c
blob11e0b2c08b31b4b2545ea186c6c6915f0919c393
1 /* Test for constant expressions: __builtin_offsetof allowed in
2 integer constant expressions but not traditional offsetof
3 expansion. */
4 /* Origin: Joseph Myers <joseph@codesourcery.com> */
5 /* { dg-do compile } */
6 /* { dg-options "-std=iso9899:1999 -pedantic-errors -ftrack-macro-expansion=0" } */
8 struct s {
9 int a;
12 struct t {
13 struct s a;
14 int b[2];
17 #define old_offsetof(TYPE, MEMBER) ((__SIZE_TYPE__)(__UINTPTR_TYPE__) &((TYPE *)0)->MEMBER)
19 enum e {
20 E1 = old_offsetof (struct s, a), /* { dg-error "constant" } */
21 E2 = old_offsetof (struct t, a.a), /* { dg-error "constant" } */
22 E3 = old_offsetof (struct t, b[1]), /* { dg-error "constant" } */
23 E4 = __builtin_offsetof (struct s, a),
24 E5 = __builtin_offsetof (struct t, a.a),
25 E6 = __builtin_offsetof (struct t, b[1])