aboutsummaryrefslogtreecommitdiff
path: root/testsuite/compilable/generic_const_inference.elna
blob: c9be09036e7ced46c4e7015b29954047cc0a6ddc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
program()
type
  ConstAlias = const ^Word8
  BasePtr = ^Word8
  NestedConst = const BasePtr

var
  slice: []const Word8
  aliased: ConstAlias := cast(0u: ConstAlias)
  nested: NestedConst := cast(0u: NestedConst)
  direct_const: const ^Word8 := cast(0u: const ^Word8)

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.