1 /* Test for non-lvalue arrays: test that qualifiers on non-lvalues
2    containing arrays do not remain when those arrays decay to
3    pointers.  PR 35235.  */
4 /* { dg-do compile } */
5 /* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
6 
7 int a;
8 
9 void
f(void)10 f (void)
11 {
12   const struct {
13     int a[1];
14   } s;
15   int *p1 = s.a; /* { dg-error "qualifier" } */
16   int *p2 = (a ? s : s).a;
17   /* In this case, the qualifier is properly on the array element type
18      not on the rvalue structure and so is not discarded.  */
19   struct {
20     const int a[1];
21   } t;
22   int *p3 = t.a; /* { dg-error "qualifier" } */
23   int *p4 = (a ? t : t).a; /* { dg-error "qualifier" } */
24   /* The issue could also lead to code being wrongly accepted.  */
25   const struct {
26     int a[1][1];
27   } u;
28   const int (*p5)[1] = u.a;
29   const int (*p6)[1] = (a ? u : u).a; /* { dg-error "pointer" } */
30 }
31