mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-12 09:29:07 +02:00
* fix #39860: even if the block type is not correct for the specialization of a generic routine continue to specialize it to not trigger e.g. an internal error
+ added tests
This commit is contained in:
parent
306559667c
commit
35958a9b6b
@ -3403,19 +3403,12 @@ implementation
|
|||||||
if hdef.typ=procdef then
|
if hdef.typ=procdef then
|
||||||
begin
|
begin
|
||||||
if block_type<>bt_body then
|
if block_type<>bt_body then
|
||||||
begin
|
|
||||||
message(parser_e_illegal_expression);
|
message(parser_e_illegal_expression);
|
||||||
srsym:=generrorsym;
|
|
||||||
srsymtable:=nil;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
srsym:=tprocdef(hdef).procsym;
|
srsym:=tprocdef(hdef).procsym;
|
||||||
if assigned(spezcontext.symtable) then
|
if assigned(spezcontext.symtable) then
|
||||||
srsymtable:=spezcontext.symtable
|
srsymtable:=spezcontext.symtable
|
||||||
else
|
else
|
||||||
srsymtable:=srsym.owner;
|
srsymtable:=srsym.owner;
|
||||||
end;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
internalerror(2015061204);
|
internalerror(2015061204);
|
||||||
|
14
tests/webtbf/tw39860a.pp
Normal file
14
tests/webtbf/tw39860a.pp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{ %FAIL }
|
||||||
|
|
||||||
|
{$mode objfpc}
|
||||||
|
generic function Size<T>: SizeUint;
|
||||||
|
begin
|
||||||
|
result := sizeof(T);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
a: array[0 .. specialize Size<double> - 1] of byte;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
14
tests/webtbf/tw39860b.pp
Normal file
14
tests/webtbf/tw39860b.pp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{ %FAIL }
|
||||||
|
|
||||||
|
{$mode delphi}
|
||||||
|
function Size<T>: SizeUint;
|
||||||
|
begin
|
||||||
|
result := sizeof(T);
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
a: array[0 .. Size<double> - 1] of byte;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user