fpc/tests/test/tprec19.pp
Jonas Maebe 10341eabaa * don't allow taking the address of ordinal bitpacked array elements
whose size is not a power of two
  + some more packed array/record tests

git-svn-id: trunk@7610 -
2007-06-09 18:13:04 +00:00

45 lines
579 B
ObjectPascal

type
pbyte = ^byte;
tr = bitpacked record
a,b,c: byte;
d,e:0..15;
f: byte;
g: 0..$ffffff; { 3 bytes }
h: byte;
end;
procedure p(b: pbyte);
begin
b^ := $12
end;
var
r: tr;
begin
fillchar(r,sizeof(r),0);
p(@r.a);
if (r.a<>$12) then
halt(1);
fillchar(r,sizeof(r),0);
p(@r.b);
if (r.b<>$12) then
halt(1);
fillchar(r,sizeof(r),0);
p(@r.c);
if (r.c<>$12) then
halt(1);
fillchar(r,sizeof(r),0);
p(@r.f);
if (r.f<>$12) then
halt(1);
fillchar(r,sizeof(r),0);
p(@r.h);
if (r.h<>$12) then
halt(1);
end.