aboutsummaryrefslogtreecommitdiff
path: root/testsuite/runnable
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-11-18 00:10:23 +0100
committerEugen Wissner <belka@caraus.de>2026-11-20 00:08:40 +0100
commitd4681529c20d5cb2630bfe09f4cf4c4ca4c98a23 (patch)
treed11bc100c2e35fe7ee8e84837d8e2826e4b8731e /testsuite/runnable
parent9b4b13e0d9030bb21c86eea6c4ba00bf4d91f0a0 (diff)
downloadelna-d4681529c20d5cb2630bfe09f4cf4c4ca4c98a23.tar.gz
Restrict pointer subtraction by typeHEADcpp
Diffstat (limited to 'testsuite/runnable')
-rw-r--r--testsuite/runnable/pointer_subtraction.elna18
1 files changed, 18 insertions, 0 deletions
diff --git a/testsuite/runnable/pointer_subtraction.elna b/testsuite/runnable/pointer_subtraction.elna
new file mode 100644
index 0000000..41d45f6
--- /dev/null
+++ b/testsuite/runnable/pointer_subtraction.elna
@@ -0,0 +1,18 @@
+program()
+var
+ a: [4]Int
+ first: ^Int
+ third: ^Int
+ diff: Int
+ c: ^const Int
+ diff_const: Int
+
+begin
+ first := @a[1];
+ third := @a[3];
+ diff := third - first;
+ c := third;
+ diff_const := c - first;
+ assert(diff = 2);
+ assert(diff_const = 2)
+end.