← board

Typed constant arrays (initialized const arrays)

Done (commit 54d5dda)

Landed alongside the var = init global-initializer fix: typed constants reuse the pending-init machinery (storage allocated, elements compiled as assignments before main begin). Scalar ordinal/Int64 + parenthesised ordinal/Int64 array constants, globals only. test_cross_typed_const byte-identical all 4 targets, matches FPC (incl. writing through a typed const — FPC semantics). Out of scope: string/float/record-initializer constants, local typed consts.

Gap

A typed constant with an array initializer does not parse:

const A: array[0..3] of Integer = (10, 20, 30, 40);   { Expected: = }

Scalar typed constants work; the array-initializer form ( v0, v1, ... ) is not handled. FPC accepts it and it is common for lookup tables.

Scope

Notes