mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 17:09:09 +02:00
* do not call typecheckpass unncessarily in generic definitions, it might cause only errors, resolves #28058
git-svn-id: trunk@31262 -
This commit is contained in:
parent
f1decfb6b6
commit
9a55e8fa3c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -14661,6 +14661,7 @@ tests/webtbs/tw27998.pp svneol=native#text/plain
|
||||
tests/webtbs/tw27998a.pp svneol=native#text/plain
|
||||
tests/webtbs/tw28007.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2803.pp svneol=native#text/plain
|
||||
tests/webtbs/tw28058.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw2806.pp svneol=native#text/plain
|
||||
tests/webtbs/tw2807.pp svneol=native#text/plain
|
||||
tests/webtbs/tw28089.pp svneol=native#text/plain
|
||||
|
@ -1284,6 +1284,9 @@ implementation
|
||||
if p.nodetype in [vecn,derefn,typeconvn,subscriptn,loadn] then
|
||||
maybe_call_procvar(p,false);
|
||||
|
||||
{ additional checks make no sense in a generic definition }
|
||||
if not(df_generic in current_procinfo.procdef.defoptions) then
|
||||
begin
|
||||
{ blockn support because a read/write is changed into a blocknode
|
||||
with a separate statement for each read/write operation (JM)
|
||||
the same is true for val() if the third parameter is not 32 bit
|
||||
@ -1327,10 +1330,13 @@ implementation
|
||||
) then
|
||||
Message(parser_e_illegal_expression);
|
||||
end;
|
||||
end;
|
||||
code:=p;
|
||||
end;
|
||||
end;
|
||||
if assigned(code) then
|
||||
if assigned(code) and
|
||||
{ type checking makes no sense in a generic definition }
|
||||
not(df_generic in current_procinfo.procdef.defoptions) then
|
||||
begin
|
||||
typecheckpass(code);
|
||||
code.fileinfo:=filepos;
|
||||
|
@ -1855,6 +1855,8 @@ implementation
|
||||
entrypos:=code.fileinfo;
|
||||
|
||||
{ Finish type checking pass }
|
||||
{ type checking makes no sense in a generic definition }
|
||||
if not(df_generic in current_procinfo.procdef.defoptions) then
|
||||
do_typecheckpass(code);
|
||||
|
||||
if assigned(procdef.parentfpinitblock) then
|
||||
|
20
tests/webtbs/tw28058.pp
Normal file
20
tests/webtbs/tw28058.pp
Normal file
@ -0,0 +1,20 @@
|
||||
{$mode objfpc}
|
||||
program Project1;
|
||||
type
|
||||
generic TFoo<T> = class
|
||||
const
|
||||
Size = SizeOf(T);
|
||||
public
|
||||
function X: Integer;
|
||||
end;
|
||||
|
||||
{ TFoo }
|
||||
|
||||
function TFoo.X: Integer;
|
||||
begin
|
||||
//Result := 100 div SizeOf(T);
|
||||
Result := 100 div Size;
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user