]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/c90-array-lval-4.c
replace ISL with isl
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / c90-array-lval-4.c
CommitLineData
207bf485
JM
1/* Test for non-lvalue arrays decaying to pointers: in C99 only.
2 Test various ways of producing non-lvalue arrays. */
3/* Origin: Joseph Myers <jsm28@cam.ac.uk> */
4/* { dg-do compile } */
5/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
6
7struct s { char c[17]; };
8
9struct s x;
10
11struct s a, b, c;
12int d;
13
14#define ASSERT(v, a) char v[((a) ? 1 : -1)]
15
16ASSERT (p, sizeof (x.c) == 17);
17ASSERT (q, sizeof (0, x.c) == sizeof (char *));
18ASSERT (r0, sizeof ((d ? b : c).c) == 17);
19ASSERT (r1, sizeof ((d, b).c) == 17);
20ASSERT (r2, sizeof ((a = b).c) == 17);
21/* The non-lvalue array does not decay to a pointer, so the comma expression
22 has (non-lvalue) array type.
23*/
24ASSERT (s0, sizeof (0, (d ? b : c).c) == 17); /* { dg-bogus "array" "bad non-lvalue array handling" } */
25ASSERT (s0, sizeof (0, (d, b).c) == 17); /* { dg-bogus "array" "bad non-lvalue array handling" } */
26ASSERT (s0, sizeof (0, (a = b).c) == 17); /* { dg-bogus "array" "bad non-lvalue array handling" } */