aboutsummaryrefslogtreecommitdiff
path: root/testsuite/compilable/generic_const_inference.elna
blob: 7ce197f8c91358fdfc8966ad7eb5bc66e726b2c5 (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 := 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.