diff options
-rw-r--r-- | test/enum.c | 23 | ||||
-rw-r--r-- | test/enum.qbe | 0 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/enum.c b/test/enum.c new file mode 100644 index 0000000..20ea64d --- /dev/null +++ b/test/enum.c @@ -0,0 +1,23 @@ +enum E1 { + A1 = 1u, + B1 = -1, + A1type = __builtin_types_compatible_p(typeof(A1), int), + B1type = __builtin_types_compatible_p(typeof(B1), int), +}; +_Static_assert(__builtin_types_compatible_p(typeof(A1), int)); +_Static_assert(A1type == 1); +_Static_assert(__builtin_types_compatible_p(typeof(B1), int)); +_Static_assert(B1type == 1); +_Static_assert(__builtin_types_compatible_p(enum E1, int)); + +enum E2 { + A2 = 1, + B2 = 2, + A2type = __builtin_types_compatible_p(typeof(A2), int), + B2type = __builtin_types_compatible_p(typeof(B2), int), +}; +_Static_assert(__builtin_types_compatible_p(typeof(A2), int)); +_Static_assert(A2type == 1); +_Static_assert(__builtin_types_compatible_p(typeof(B2), int)); +_Static_assert(B2type == 1); +_Static_assert(__builtin_types_compatible_p(enum E2, unsigned)); diff --git a/test/enum.qbe b/test/enum.qbe new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/enum.qbe |