1 /* Testing the correct usage of attribute counted_by in c23, multiple
2 * definitions of the same tag in same or different scopes.
4 * { dg-options "-std=c23" }
7 /* Allowed redefinitions of the same struct in the same scope, with the
8 same counted_by attribute. */
12 int a
[] __attribute__ ((counted_by (b
))); };
16 int a
[] __attribute__ ((counted_by (b
))); };
20 int a
[]; }; /* { dg-error "redefinition of struct or union" } */
22 /* Error when the counted_by attribute is defined differently. */
26 int a
[] __attribute__ ((counted_by (c
))); }; /* { dg-error "redefinition of struct or union" } */
31 int a
[] __attribute__ ((counted_by (b
))); } p
;
38 int a
[] __attribute__ ((counted_by (b
))); } x
;
48 int a
[] __attribute__ ((counted_by (c
))); } y
;
50 p
= y
; /* { dg-error "incompatible types when assigning to type" } */
61 char c
[] __attribute__ ((counted_by (b
)));
72 char c
[] __attribute__ ((counted_by (b
)));
83 char c
[] __attribute__ ((counted_by (n
)));
84 }; /* { dg-error "redefinition of struct or union" } */
94 char c
[] __attribute__ ((counted_by (b
)));
107 char c
[] __attribute__ ((counted_by (b
)));
123 char c
[] __attribute__ ((counted_by (n
)));
126 nested_p
= nested_y
; /* { dg-error "incompatible types when assigning to type" } */