From eb4320fcc6caf885038fe8b7b7d33ed87eb56608 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Thu, 1 Jul 2021 01:34:00 -0700 Subject: 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. --- test/struct-flexible-array.c | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/struct-flexible-array.c (limited to 'test/struct-flexible-array.c') 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]; +} -- cgit v1.2.3