[PATCH 04/12] enum: add testcase for type of enum members

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Members of an enum should all have the same type but
isn't so currently.

Add a testcase for it and mark it as 'known-to-fail'.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/enum-same-type.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
 create mode 100644 validation/enum-same-type.c

diff --git a/validation/enum-same-type.c b/validation/enum-same-type.c
new file mode 100644
index 000000000..ac410a03a
--- /dev/null
+++ b/validation/enum-same-type.c
@@ -0,0 +1,15 @@
+enum num {
+	NEG = -1,
+	NIL = 0,
+	ONE = 1U,
+	DUO = 2LL,
+};
+
+_Static_assert([typeof(NIL)] == [typeof(NEG)], "enum same type");
+_Static_assert([typeof(ONE)] == [typeof(NEG)], "enum same type");
+_Static_assert([typeof(DUO)] == [typeof(NEG)], "enum same type");
+
+/*
+ * check-name: enum-same-type
+ * check-known-to-fail
+ */
-- 
2.18.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux