From d345c729b2418f5f536e7fc401047a9a473bdf01 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Tue, 16 Apr 2024 14:50:26 -0700 Subject: test: Add test for compatible array types --- test/compatible-array-types.c | 9 +++++++++ test/compatible-array-types.qbe | 0 2 files changed, 9 insertions(+) create mode 100644 test/compatible-array-types.c create mode 100644 test/compatible-array-types.qbe 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 -- cgit v1.2.3