| 1 |
/* PR c/65345 */ |
| 2 |
/* { dg-options "" } */ |
| 3 |
|
| 4 |
_Atomic float i = 3.0f; |
| 5 |
|
| 6 |
float a1 = sizeof (i + 1.2); |
| 7 |
float a2 = sizeof (i = 0); |
| 8 |
float a3 = sizeof (i++); |
| 9 |
float a4 = sizeof (i--); |
| 10 |
float a5 = sizeof (-i); |
| 11 |
|
| 12 |
float b1 = _Alignof (i + 1); |
| 13 |
float b2 = _Alignof (i = 0); |
| 14 |
float b3 = _Alignof (i++); |
| 15 |
float b4 = _Alignof (i--); |
| 16 |
float b5 = _Alignof (-i); |
| 17 |
|
| 18 |
float c1 = i; /* { dg-error "initializer element is not constant" } */ |
| 19 |
float c2 = (i ? 1 : 2); /* { dg-error "initializer element is not constant" } */ |
| 20 |
float c3[(int) i]; /* { dg-error "variably modified" } */ |
| 21 |
float c4 = 0 || i; /* { dg-error "initializer element is not constant" } */ |
| 22 |
float c5 = (i += 10); /* { dg-error "initializer element is not constant" } */ |
| 23 |
|
| 24 |
_Static_assert (_Generic (i, float: 1, default: 0) == 1, "1"); |
| 25 |
_Static_assert (_Generic (i + 1, float: 1, default: 0) == 1, "2"); |
| 26 |
_Static_assert (_Generic (i = 0, float: 1, default: 0) == 1, "3"); |
| 27 |
_Static_assert (_Generic (i++, float: 1, default: 0) == 1, "4"); |
| 28 |
_Static_assert (_Generic (i--, float: 1, default: 0) == 1, "5"); |
| 29 |
|
| 30 |
_Atomic int sz = 2; |
| 31 |
void fn1 (float a[sz + 1]); |
| 32 |
void fn2 (float a[sz = 0]); |
| 33 |
void fn3 (float a[sz++]); |
| 34 |
void fn4 (float a[sz--]); |
| 35 |
void fn5 (float a[-sz]); |