1 /* { dg-do compile } */
2 /* { dg-options "-O -Wall" } */
4 /* C99 6.5.2.3 Structure and union members.
5 If the first expression has qualified type, the result has the so-qualified
6 version of the type of the designated member. */
8 struct s {_Decimal32 d32; const _Decimal64 d64;};
9 struct sv { volatile _Decimal32 d32; volatile _Decimal64 d64; };
24 struct s g (struct s s)
36 cs.d32 = 1.23dd; /* { dg-error "assignment of read-only variable" } */
37 cs.d64 = 1.23df; /* { dg-error "assignment of read-only variable" } */
38 s.d64 = 1.23df; /* { dg-error "assignment of read-only member" } */
43 u.d64 = 1.23df; /* { dg-error "assignment of read-only member" } */
44 u.cs.d32 = 1.23dd; /* { dg-error "assignment of read-only member" } */
45 u.cs.d64 = 1.23df; /* { dg-error "assignment of read-only member" } */
47 cu.d32 = 1.23dd; /* { dg-error "assignment of read-only variable" } */
49 cu.d64 = 1.23df; /* { dg-error "assignment of read-only variable" } */
50 cu.cs.d32 = 1.23dd; /* { dg-error "assignment of read-only variable" } */
51 cu.cs.d64 = 1.23df; /* { dg-error "assignment of read-only variable" } */
53 /* f().x is a valid postfix expression but is not an lvalue if
54 function f() returning a structure or union. */
55 g(s).d32 = 1.23dd; /* { dg-error "lvalue required" } */
56 h(u).d64 = 1.23df; /* { dg-error "lvalue required" } */
58 /* Test assignment to volatile structure members. */