mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Flexible array member added, zero sized structs removed.
This commit is contained in:
31
test/test_suite/struct/flex_array_struct_err.c3
Normal file
31
test/test_suite/struct/flex_array_struct_err.c3
Normal file
@@ -0,0 +1,31 @@
|
||||
struct Foo
|
||||
{
|
||||
int x;
|
||||
int[*] y; // #error: flexible array member must be the last element
|
||||
int z;
|
||||
}
|
||||
|
||||
struct Bar
|
||||
{
|
||||
int[*] y; // #error: flexible array member cannot be the only element
|
||||
}
|
||||
|
||||
struct Baz
|
||||
{
|
||||
int y;
|
||||
int[*] z;
|
||||
}
|
||||
|
||||
struct BazContainerOk
|
||||
{
|
||||
int z;
|
||||
Baz c;
|
||||
}
|
||||
|
||||
struct BazContainer
|
||||
{
|
||||
Baz c; // #error: A struct member with a flexible array must be the last element.
|
||||
int y;
|
||||
}
|
||||
|
||||
Baz[5] ab; // #error: Arrays of structs with flexible array members is not allowed.
|
||||
Reference in New Issue
Block a user