aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2024-04-16 14:50:26 -0700
committerMichael Forney <mforney@mforney.org>2024-04-16 14:50:26 -0700
commitd345c729b2418f5f536e7fc401047a9a473bdf01 (patch)
treec367747a47924631404ef3287940fcd48d8f4291
parent2ab99da4111ab827b784b1f627c07a4931f7febd (diff)
test: Add test for compatible array types
-rw-r--r--test/compatible-array-types.c9
-rw-r--r--test/compatible-array-types.qbe0
2 files changed, 9 insertions, 0 deletions
diff --git a/test/compatible-array-types.c b/test/compatible-array-types.c
new file mode 100644
index 0000000..61a6411
--- /dev/null
+++ b/test/compatible-array-types.c
@@ -0,0 +1,9 @@
+static_assert(__builtin_types_compatible_p(int[2], int[1 + 1]));
+static_assert(!__builtin_types_compatible_p(int[2], int[1]));
+static_assert(!__builtin_types_compatible_p(int[2], unsigned[2]));
+static_assert(!__builtin_types_compatible_p(const int (*)[2], int (*)[2]));
+typedef int T[2];
+/* FIXME
+static_assert(__builtin_types_compatible_p(const T *, const int (*)[2]));
+*/
+static_assert(__builtin_types_compatible_p(float[], float[3]));
diff --git a/test/compatible-array-types.qbe b/test/compatible-array-types.qbe
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/compatible-array-types.qbe