Adam Naumowicz wrote:
Hello,
On Thu, 18 Apr 2002, Ernst-Ludwig Bohnen wrote:
On Wed, 17 Apr 2002, Carel Fellinger wrote:
Hai,
after porting a few thousand lines I think I spotted the next bug.
take this simple program:
program err;
type pword = ^word; word = boolean;
word is predeclared as unsigned 32 bit integer. Should gpc complain already here or warn and accept the redefinition and do the job? Ernst-Ludwig
As far as I got the ISO standard correct, the 'pword' definition should only be considered a foreward declaration of 'word' when 'word' is undefined and has a definition later in the same block. So the current behaviour of GPC seems rather consequent to me and I don't understand why all Barland's compilers and FPC process it the other way ;-(
This is not the current behaviour of gpc. See the following snippet
------------------------------------------------------------------------
program forw;
type foo = real;
function testI: boolean; type p = ^foo; foo = integer; var v : p; begin testI := SizeOf(v^) = SizeOf(integer); end;
function testR: boolean; type p = ^foo; var v : p; begin testR := SizeOf(v^) = SizeOf(real); end;
begin if testI and testR then writeln('OK') else writeln('failed'); end.
-----------------------------------------------------------------
In testI type foo in entering the block is real as in testR, and p is considered as forward since v^ is integer.
The problem seems special to the predeclared identifier "word"
Maurice