2 /* { dg-do compile } */
3 /* { dg-options "-Wconversion" } */
5 struct S
{ int n
, u
[2]; };
6 const signed char z
[] = {
7 [0] = 0x100, /* { dg-warning "9:overflow in implicit constant conversion" } */
8 [2] = 0x101, /* { dg-warning "9:overflow in implicit constant conversion" } */
11 0, 0x80000000, /* { dg-warning "16:conversion of unsigned constant value to negative integer" } */
12 0xA, 0x80000000, /* { dg-warning "18:conversion of unsigned constant value to negative integer" } */
13 0xA, 0xA, 0x80000000 /* { dg-warning "23:conversion of unsigned constant value to negative integer" } */
15 int *p
= (int []) { 0x80000000 }; /* { dg-warning "21:conversion of unsigned constant value to negative integer" } */
16 union { int k
; } u
= { .k
= 0x80000000 }; /* { dg-warning "29:conversion of unsigned constant value to negative integer" } */
21 signed char a
[][3] = { { 0x100, /* { dg-warning "28:overflow in implicit constant conversion" } */
22 1, 0x100 }, /* { dg-warning "24:overflow in implicit constant conversion" } */
23 { '\0', 0x100, '\0' } /* { dg-warning "27:overflow in implicit constant conversion" } */
25 (const signed char []) { 0x100 }; /* { dg-warning "28:overflow in implicit constant conversion" } */
26 (const float []) { 1e0
, 1e1
, 1e100
}; /* { dg-warning "32:conversion" } */
27 struct S s1
= { 0x80000000 }; /* { dg-warning "19:conversion of unsigned constant value to negative integer" } */
28 struct S s2
= { .n
= 0x80000000 }; /* { dg-warning "24:conversion of unsigned constant value to negative integer" } */
29 struct S s3
= { .u
[1] = 0x80000000 }; /* { dg-warning "27:conversion of unsigned constant value to negative integer" } */
30 H h
= { 1, 2, 0x80000000 }; /* { dg-warning "17:conversion of unsigned constant value to negative integer" } */