aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
Diffstat (limited to 'validation')
-rw-r--r--validation/transparent-union.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/validation/transparent-union.c b/validation/transparent-union.c
new file mode 100644
index 00000000..149c7d94
--- /dev/null
+++ b/validation/transparent-union.c
@@ -0,0 +1,25 @@
+struct a {
+ int field;
+};
+struct b {
+ int field;
+};
+
+typedef union {
+ struct a *a;
+ struct b *b;
+} transparent_arg __attribute__((__transparent_union__));
+
+static void foo(transparent_arg arg)
+{
+}
+
+static void bar(void)
+{
+ struct b arg = { 0 };
+ foo((struct a *) &arg);
+}
+
+/*
+ * check-name: Transparent union attribute.
+ */