mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 20:50:42 +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
|
||||
begin
|
||||
if block_type<>bt_body then
|
||||
begin
|
||||
message(parser_e_illegal_expression);
|
||||
srsym:=generrorsym;
|
||||
srsymtable:=nil;
|
||||
end
|
||||
message(parser_e_illegal_expression);
|
||||
srsym:=tprocdef(hdef).procsym;
|
||||
if assigned(spezcontext.symtable) then
|
||||
srsymtable:=spezcontext.symtable
|
||||
else
|
||||
begin
|
||||
srsym:=tprocdef(hdef).procsym;
|
||||
if assigned(spezcontext.symtable) then
|
||||
srsymtable:=spezcontext.symtable
|
||||
else
|
||||
srsymtable:=srsym.owner;
|
||||
end;
|
||||
srsymtable:=srsym.owner;
|
||||
end
|
||||
else
|
||||
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