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.
7 Based on the test from ../dfp/. */
9 struct s
{_Fract f
; const long _Fract lf
;};
10 struct sv
{ volatile _Fract f
; volatile long _Fract lf
; };
25 struct s
g (struct s s
)
37 cs
.f
= 0.1r
; /* { dg-error "assignment of read-only variable" } */
38 cs
.lf
= 0.2lr
; /* { dg-error "assignment of read-only variable" } */
39 s
.lf
= 0.3lr
; /* { dg-error "assignment of read-only member" } */
44 u
.lf
= 0.6lr
; /* { dg-error "assignment of read-only member" } */
45 u
.cs
.f
= 0.7r
; /* { dg-error "assignment of read-only member" } */
46 u
.cs
.lf
= 0.8lr
; /* { dg-error "assignment of read-only member" } */
48 cu
.f
= 0.9r
; /* { dg-error "assignment of read-only variable" } */
50 cu
.lf
= 0.01lr
; /* { dg-error "assignment of read-only variable" } */
51 cu
.cs
.f
= 0.02r
; /* { dg-error "assignment of read-only variable" } */
52 cu
.cs
.lf
= 0.03lr
; /* { dg-error "assignment of read-only variable" } */
54 /* f().x is a valid postfix expression but is not an lvalue if
55 function f() returning a structure or union. */
56 g(s
).f
= 0.04r
; /* { dg-error "lvalue required" } */
57 h(u
).lf
= 0.05lr
; /* { dg-error "lvalue required" } */
59 /* Test assignment to volatile structure members. */