aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/flex-array-error.c
diff options
Diffstat (limited to 'validation/flex-array-error.c')
-rw-r--r--validation/flex-array-error.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/validation/flex-array-error.c b/validation/flex-array-error.c
new file mode 100644
index 00000000..89601e42
--- /dev/null
+++ b/validation/flex-array-error.c
@@ -0,0 +1,27 @@
+struct s {
+ int i;
+ long f[];
+ int j;
+};
+
+union u {
+ int i;
+ long f[];
+};
+
+// trigger the examination of the offending types
+static int foo(struct s *s, union u *u)
+{
+ return __builtin_offsetof(typeof(*s), i)
+ + __builtin_offsetof(typeof(*u), i);
+}
+
+/*
+ * check-name: flex-array-error
+ * check-known-to-fail
+ *
+ * check-error-start
+flex-array-error.c:3:14: error: flexible array member 'f' is not last
+flex-array-error.c:9:14: error: flexible array member 'f' in a union
+ * check-error-end
+ */