* give an error when trying to use (bit)sizeof on a type that is not yet

resolved by the compiler (mantis #14354)

git-svn-id: trunk@16112 -
This commit is contained in:
Jonas Maebe 2010-10-08 17:42:53 +00:00
parent 41e388ace8
commit db8a67747d
3 changed files with 18 additions and 0 deletions

1
.gitattributes vendored
View File

@ -9900,6 +9900,7 @@ tests/webtbf/tw14104b.pp svneol=native#text/plain
tests/webtbf/tw14104c.pp svneol=native#text/plain
tests/webtbf/tw14248.pp svneol=native#text/plain
tests/webtbf/tw1432.pp svneol=native#text/plain
tests/webtbf/tw14354.pp svneol=native#text/plain
tests/webtbf/tw14650.pp svneol=native#text/plain
tests/webtbf/tw14650a.pp svneol=native#text/plain
tests/webtbf/tw1467.pp svneol=native#text/plain

View File

@ -404,6 +404,8 @@ implementation
end
else
begin
if (p1.resultdef.typ=forwarddef) then
Message1(type_e_type_is_not_completly_defined,tforwarddef(p1.resultdef).tosymname^);
if (l = in_sizeof_x) or
(not((p1.nodetype = vecn) and
is_packed_array(tvecnode(p1).left.resultdef)) and

15
tests/webtbf/tw14354.pp Normal file
View File

@ -0,0 +1,15 @@
{ %fail }
{$mode objfpc}{$H+}
type
PFoo = ^TFoo;
TFoo = array[0..10] of Integer;
TBar = array[0..SizeOf(PFoo(nil)^)] of Integer;
var
Bar: TBar;
begin
if High(Bar) <> SizeOf(TFoo) then
WriteLn('Error: ', High(Bar), ' <> ', SizeOf(TFoo));
end.