The Delphi 10.2 I have also compiles the empty const and type sections.
Delphi 10.4. Screen attached.
I see what the issue is, cause I wasn't clear enough..
So the code tested by you and originally provided by
simone for the
const and
type cases is simply wrong, because the order is first the visibility section (if any, default is either
public or
published depending on
$M) and then the type of the section (with default being
var).
What
I meant however is an empty
var,
const or
type section followed by a visibility specifier and then followed by some entry for a
var section (because a visibility specifier always starts a new section which is
var if nothing else is mentioned). This compiles in both FPC and Delphi (so nothing to fix here either).