aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2019-04-20 20:24:52 -0700
committerMichael Forney <mforney@mforney.org>2019-04-20 20:55:04 -0700
commit82590e5121136414c78d17454d666084d7b19302 (patch)
tree1c8d52356e4bad75cdb118179ac92a6a51b8c77a /test
parent8c343ad7edd73c169d865c64e7868e3ec447ecda (diff)
eval: Handle casts in constant expressions
Fixes #23.
Diffstat (limited to 'test')
-rw-r--r--test/const-expr-cast.c7
-rw-r--r--test/const-expr-cast.qbe3
2 files changed, 10 insertions, 0 deletions
diff --git a/test/const-expr-cast.c b/test/const-expr-cast.c
new file mode 100644
index 0000000..10a3eac
--- /dev/null
+++ b/test/const-expr-cast.c
@@ -0,0 +1,7 @@
+enum {
+ A = (unsigned char)0x321,
+ B = (short)-2147438112,
+ C = 0x80000003 * 2,
+};
+
+int a = A, b = B, c = C;
diff --git a/test/const-expr-cast.qbe b/test/const-expr-cast.qbe
new file mode 100644
index 0000000..b36aefc
--- /dev/null
+++ b/test/const-expr-cast.qbe
@@ -0,0 +1,3 @@
+export data $a = align 4 { w 33, }
+export data $b = align 4 { w 18446744073709531616, }
+export data $c = align 4 { w 6, }