aboutsummaryrefslogtreecommitdiff
path: root/test/struct-flexible-array.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-07-01 01:34:00 -0700
committerMichael Forney <mforney@mforney.org>2021-07-01 01:52:13 -0700
commiteb4320fcc6caf885038fe8b7b7d33ed87eb56608 (patch)
tree6e6c5afef7646c48be2bc5e57bbfbd9b8ce4c454 /test/struct-flexible-array.c
parentb2dc1102c3ae0976e9435f80df660b821742a2c8 (diff)
decl: Disallow members with incomplete types
Make an exception for flexible array members, though we should also check that the flexible array member, if any, is last.
Diffstat (limited to 'test/struct-flexible-array.c')
-rw-r--r--test/struct-flexible-array.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/struct-flexible-array.c b/test/struct-flexible-array.c
new file mode 100644
index 0000000..57bd95a
--- /dev/null
+++ b/test/struct-flexible-array.c
@@ -0,0 +1,10 @@
+struct s {
+ int a;
+ short b[];
+};
+
+int x = sizeof(struct s);
+
+int f(struct s *s) {
+ return s->b[2];
+}