From c378bbe212ec5138198b5c0ea44cf8c7732b723e Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 14 Sep 2021 05:12:15 +0200 Subject: vhdl-sem_expr.adb: adjust aggregate element type extraction. For #737 --- src/vhdl/vhdl-sem_expr.adb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb index 59a167500..a70e197b9 100644 --- a/src/vhdl/vhdl-sem_expr.adb +++ b/src/vhdl/vhdl-sem_expr.adb @@ -3576,6 +3576,9 @@ package body Vhdl.Sem_Expr is end case; else New_El_Subtype := Get_Type (Sub_Aggr); + if not Get_Element_Type_Flag (Assoc) then + New_El_Subtype := Get_Element_Subtype (New_El_Subtype); + end if; -- TODO: try to extract the 'best' element subtype: with -- static indexes, with constrained sub-elements. -- Possibly create an hybrid subtype (for records). @@ -3662,8 +3665,10 @@ package body Vhdl.Sem_Expr is Sem_Array_Aggregate_Check_Element_Subtype (El_Subtype, Sub_Aggr, Dim + 1, Nbr_Dim); else - -- TODO: only report the first error ? - Check_Matching_Subtype (Sub_Aggr, El_Subtype); + if Get_Element_Type_Flag (Assoc) then + -- TODO: only report the first error ? + Check_Matching_Subtype (Sub_Aggr, El_Subtype); + end if; end if; end if; Assoc := Get_Chain (Assoc); -- cgit v1.2.3