From 5d808dd4c4003968bbdf180e1e1193231db5d43b Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Sat, 3 Oct 2026 10:08:05 +0200 Subject: Strip outmost constness on infered arguments --- testsuite/compilable/generic_const_inference.elna | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 testsuite/compilable/generic_const_inference.elna (limited to 'testsuite/compilable/generic_const_inference.elna') diff --git a/testsuite/compilable/generic_const_inference.elna b/testsuite/compilable/generic_const_inference.elna new file mode 100644 index 0000000..a9fc41f --- /dev/null +++ b/testsuite/compilable/generic_const_inference.elna @@ -0,0 +1,28 @@ +program() +type + ConstAlias = const ^Word8 + BasePtr = ^Word8 + NestedConst = const BasePtr + +var + slice: []const Word8 + aliased: ConstAlias := nil + nested: NestedConst := nil + direct_const: const ^Word8 := nil + +proc write#[T](fd: Int; buf: T; count: Int) -> Int +return 0 + +proc write_const#[T](fd: Int; buf: const T; count: Int) -> Int +return 0 + +begin + write(1, slice.ptr, cast(slice.length: Int)); + write(1, aliased, 0); + write(1, nested, 0); + write(1, direct_const, 0); + write_const(1, slice.ptr, cast(slice.length: Int)); + write_const(1, aliased, 0); + write_const(1, nested, 0); + write_const(1, direct_const, 0) +end. -- cgit v1.2.3