* fix #40708: when creating the sub-arraydefs for comma separated arrays, ensure that the new sub array also has the generic related information set up correctly

+ added test
This commit is contained in:
Sven/Sarah Barth 2024-04-12 15:25:04 +02:00
parent 326d92589a
commit 550397b982
2 changed files with 18 additions and 0 deletions

View File

@ -1623,6 +1623,10 @@ implementation
symtablestack.pop(arrdef.symtable);
arrdef:=tarraydef(arrdef.elementdef);
symtablestack.push(arrdef.symtable);
{ correctly update the generic information of the new array def }
insert_generic_parameter_types(arrdef,genericdef,genericlist,false);
if old_parse_generic then
include(arrdef.defoptions,df_generic);
end
else
begin

14
tests/webtbs/tw40708.pp Normal file
View File

@ -0,0 +1,14 @@
{ %NORUN }
program tw40708;
{$mode objfpc}
type generic TMatrix4<T> = array[0..3] of array [0..3] of T; // works
type generic TAnotherMatrix4<T> = array[0..3,0..3] of T; // "Identifier not found T"
type TMatrix4LongInt = specialize TMatrix4<LongInt>;
type TAnotherMatrix4LongInt = specialize TAnotherMatrix4<LongInt>;
begin
end.