mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 04:09:15 +02:00
* 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:
parent
41e388ace8
commit
db8a67747d
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -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
|
||||
|
@ -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
15
tests/webtbf/tw14354.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user