summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-05-01 18:50:04 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-10-05 03:29:19 +0200
commit1a889a2e2efa56c3966add10a4db2aa08dbc8129 (patch)
treecfc89753528bb21113344e150152d930fe1784b5
parentbff011270111c3fcdc0b7a5490d7d0c92c0c50ea (diff)
downloadsparse-1a889a2e2efa56c3966add10a4db2aa08dbc8129.tar.gz
enum: add testcase for type of enum members
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@gmail.com>
-rw-r--r--validation/enum-same-type.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/validation/enum-same-type.c b/validation/enum-same-type.c
new file mode 100644
index 00000000..ac410a03
--- /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
+ */