aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl/vhdl-sem_expr.adb
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-12-10 21:51:45 +0100
committerTristan Gingold <tgingold@free.fr>2022-12-10 21:51:45 +0100
commit1816aea7669e10dc68a7f20d7956e40b727d87b8 (patch)
tree69e0f87c3eca1ee61798c459d8d71182d2e3977e /src/vhdl/vhdl-sem_expr.adb
parent7739aad5085e7076807545000662fd819cca2f3a (diff)
downloadghdl-1816aea7669e10dc68a7f20d7956e40b727d87b8.tar.gz
ghdl-1816aea7669e10dc68a7f20d7956e40b727d87b8.tar.bz2
ghdl-1816aea7669e10dc68a7f20d7956e40b727d87b8.zip
vhdl: handle dynamically bounded aggregates with unbounded element.
Fix #2216
Diffstat (limited to 'src/vhdl/vhdl-sem_expr.adb')
-rw-r--r--src/vhdl/vhdl-sem_expr.adb14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb
index 3dd86d900..ffc5d3714 100644
--- a/src/vhdl/vhdl-sem_expr.adb
+++ b/src/vhdl/vhdl-sem_expr.adb
@@ -4251,10 +4251,6 @@ package body Vhdl.Sem_Expr is
Sem_Array_Aggregate_Extract_Element_Subtype
(Aggr, 1, Nbr_Dim, El_Subtype);
if El_Subtype = Null_Iir then
- if not Constrained then
- Error_Msg_Sem
- (+Aggr, "no element bounds for self-determined aggregate");
- end if;
El_Subtype := El_Type;
else
-- TODO: check constraints of elements (if El_Subtype is static)
@@ -4300,8 +4296,14 @@ package body Vhdl.Sem_Expr is
end;
Set_Type_Staticness (A_Subtype, Type_Staticness);
Set_Index_Constraint_Flag (A_Subtype, True);
- -- FIXME: the element can be unconstrained.
- Set_Constraint_State (A_Subtype, Fully_Constrained);
+ if Get_Kind (El_Subtype) in Iir_Kinds_Composite_Type_Definition
+ then
+ Set_Constraint_State
+ (A_Subtype, Get_Constraint_State (El_Subtype));
+ else
+ Set_Constraint_State
+ (A_Subtype, Fully_Constrained);
+ end if;
Set_Type (Aggr, A_Subtype);
Set_Literal_Subtype (Aggr, A_Subtype);
end if;