From 08173d7f88f8551caca81594ed8af79d82d3f71f Mon Sep 17 00:00:00 2001 From: zinc Date: Thu, 15 Oct 2026 18:25:36 +0330 Subject: constant expressions: c precedence and / % ^ (b.1.3); local const usable in constant expressions (b.1.7, b.2.16); zc0 matches --- tests/conformance/3-expressions/const_expr_precedence.zc | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 tests/conformance/3-expressions/const_expr_precedence.zc (limited to 'tests/conformance/3-expressions/const_expr_precedence.zc') diff --git a/tests/conformance/3-expressions/const_expr_precedence.zc b/tests/conformance/3-expressions/const_expr_precedence.zc new file mode 100644 index 0000000..c173959 --- /dev/null +++ b/tests/conformance/3-expressions/const_expr_precedence.zc @@ -0,0 +1,9 @@ +// expect: 7/5/7/255/16/ +include rt; +void pn(int x) { rt.put_n(x); rt.put_c(10); } +const X = 1 + 2 * 3; +const Y = 10 - 2 - 3; +const V = 1 | 2 + 4; +const W = ~0 & 255; +const S = 1 + 3 << 1 + 1 >> 1 - 1 | 6 & 2; +fn main() { pn(X); pn(Y); pn(V); pn(W); pn(S - 2); return 0; } -- cgit v1.2.3