From 6eaec8726f716b2ab6b48c8cd3d7fee6aaf86977 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 1 Sep 2026 17:44:38 +0200 Subject: Reject pointer arithmetic on opaque pointers --- testsuite/fail_compilation/opaque_pointer_arithmetic.elna | 9 +++++++++ testsuite/fail_compilation/opaque_slice_element.elna | 8 ++++++++ 2 files changed, 17 insertions(+) create mode 100644 testsuite/fail_compilation/opaque_pointer_arithmetic.elna create mode 100644 testsuite/fail_compilation/opaque_slice_element.elna (limited to 'testsuite/fail_compilation') diff --git a/testsuite/fail_compilation/opaque_pointer_arithmetic.elna b/testsuite/fail_compilation/opaque_pointer_arithmetic.elna new file mode 100644 index 0000000..307aed8 --- /dev/null +++ b/testsuite/fail_compilation/opaque_pointer_arithmetic.elna @@ -0,0 +1,9 @@ +type + Handle = extern + +var + p: ^Handle + +begin + p := p + 1 (* @Error Opaque type 'Handle' cannot be used as an element type in pointer arithmetic *) +end. diff --git a/testsuite/fail_compilation/opaque_slice_element.elna b/testsuite/fail_compilation/opaque_slice_element.elna new file mode 100644 index 0000000..0f28dae --- /dev/null +++ b/testsuite/fail_compilation/opaque_slice_element.elna @@ -0,0 +1,8 @@ +type + Handle = extern + +var + s: []Handle (* @Error Opaque type 'Handle' cannot be used to declare a variable *) + +begin +end. -- cgit v1.2.3