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 member 'd32' in read-only object" } */
37 cs
.d64
= 1.23df
; /* { dg-error "assignment of member 'd64' in read-only object" } */
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 member 'd32' in read-only object" } */
45 u
.cs
.d64
= 1.23df
; /* { dg-error "assignment of member 'd64' in read-only object" } */
47 cu
.d32
= 1.23dd
; /* { dg-error "assignment of member 'd32' in read-only object" } */
49 cu
.d64
= 1.23df
; /* { dg-error "assignment of member 'd64' in read-only object" } */
50 cu
.cs
.d32
= 1.23dd
; /* { dg-error "assignment of member 'd32' in read-only object" } */
51 cu
.cs
.d64
= 1.23df
; /* { dg-error "assignment of member 'd64' in read-only object" } */
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. */