Invalid use of unpack (3)

Official Description

6.6.5.4 For unpack, it is an error if the index-type of the unpacked array is exceeded.

Simplified Description

In other words, it is an error if the unpack procedure attempts to transfer array elements from the packed array into elements of the unpacked array that do not exist. For example given:

var
   unpacked_value : array[1..10] of integer;
   packed_value : packed array[21..30] of integer;

then

   unpack(packed_value, unpacked_value, 2);

means that the unpack procedure should attempt to transfer all ten elements from the packed array into the unpacked array starting at element 2 (i.e. transfer elements 21-30 from the packed array into elements 2-11 of the unpacked array), but the unpacked array does not have an element 11.

Error Handling

This error is always reported.