From 82590e5121136414c78d17454d666084d7b19302 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Sat, 20 Apr 2019 20:24:52 -0700 Subject: eval: Handle casts in constant expressions Fixes #23. --- test/const-expr-cast.c | 7 +++++++ test/const-expr-cast.qbe | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 test/const-expr-cast.c create mode 100644 test/const-expr-cast.qbe (limited to 'test') 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, } -- cgit v1.2.3