{$mode ISO} accepts Extended Pascal block as a block

Original Reporter info from Mantis: kays @KaiBurghardt
  • Reporter name: Kai Burghardt

Description:

In ISO 7185 a block consist of

  1. exactly one optional label-section,
  2. exactly one optional const-section,
  3. exactly one optional type-section,
  4. exactly one optional var-section
  5. optionally routine declarations and definitions
  6. exactly one compound statement

in that order. Confer http://pascal-central.com/iso7185.html#6.2.1%20Blocks

Steps to reproduce:

However, the following program is accepted, but should fail to compile, because it is out of order:

{$mode ISO}
program blocks(input, output);

procedure foo;
begin
	writeLn('Hi!');
end;

var
	x: integer;

type
	r = record end;

const
	answer = 42;

begin
end.

Additional information:

In Extended Pascal, ISO 10206, this restriction is lifted. There, in EP, can be as many sections and routine declaration/definitions parts as necessary, and they can occur in any order, as long as there is one compound statement at the end.

Mantis conversion info:

  • Mantis ID: 37739
  • OS: GNU/Linux
  • OS Build: 4.2.0
  • Build: 3.2.0+dfsg-7 [2020/08/21]
  • Platform: x86_64
  • Version: 3.2.0
  • Fixed in version: 3.3.1