[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gcc.dg / pr56078.c
blobba759f2209b55a9a1f6e6157f08bbc6e69f6395e
1 /* PR c/56078 */
2 /* { dg-do run } */
3 /* { dg-options "-std=gnu99" } */
5 typedef __SIZE_TYPE__ size_t;
6 extern int memcmp (const void *, const void *, size_t);
7 extern void abort (void);
9 struct T { int a; char b[]; };
10 struct T t1 = { .a = 1, .b = "abcd", .b[0] = '2' };
11 struct T t2 = { .a = 1, .b = "2bcd" };
12 struct T t3 = { .a = 1, .b[2] = 'a' };
13 struct T t4 = { .a = 1, .b = { '\0', '\0', 'a' } };
14 struct T t5 = { .a = 1, .b = { [0] = 'a', [1] = 'b', [2] = 'c' } };
15 struct T t6 = { .a = 1, .b[2] = 'c', .b[1] = 'x', .b[0] = 'a', .b[1] = 'b' };
17 int
18 main ()
20 if (memcmp (t1.b, t2.b, sizeof ("abcd")) != 0
21 || memcmp (t3.b, t4.b, 3) != 0
22 || memcmp (t5.b, t6.b, 3) != 0)
23 abort ();
24 return 0;