diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-11-02 18:43:40 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-11-02 20:58:22 +0100 |
commit | bf5c6cda62ba36320ac2b9f133757ed9c6b8e5a6 (patch) | |
tree | fe8a0025dcf7da8085a6886e2bcee4dc7eb572f9 /src/vhdl/vhdl-sem_expr.adb | |
parent | 0d61fecf1249a5c2ae83d933274ee9a638f6ec69 (diff) | |
download | ghdl-bf5c6cda62ba36320ac2b9f133757ed9c6b8e5a6.tar.gz ghdl-bf5c6cda62ba36320ac2b9f133757ed9c6b8e5a6.tar.bz2 ghdl-bf5c6cda62ba36320ac2b9f133757ed9c6b8e5a6.zip |
vhdl-sem_expr(sem_qualified_expression): relax staticness rules.
Fix #2238
Diffstat (limited to 'src/vhdl/vhdl-sem_expr.adb')
-rw-r--r-- | src/vhdl/vhdl-sem_expr.adb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb index 3f4d7890b..5b5010319 100644 --- a/src/vhdl/vhdl-sem_expr.adb +++ b/src/vhdl/vhdl-sem_expr.adb @@ -4668,11 +4668,21 @@ package body Vhdl.Sem_Expr is -- i) A qualified expression whose type mark denotes a locally static -- subtype and whose operand is a locally static expression. -- - -- We always use the vhdl08, because it is weird to have locally + -- We use the vhdl08 definition, because it is weird to have locally -- static expression with a non-locally static subtype. Set_Expr_Staticness (Expr, Min (Get_Expr_Staticness (Res), Get_Type_Staticness (N_Type))); + -- But be nice with vhdl93 if the type mark is an array type definition. + -- In that case copy the type from the expression. + if Flags.Vhdl_Std < Vhdl_08 + and then Get_Kind (N_Type) = Iir_Kind_Array_Type_Definition + and then Get_Expr_Staticness (Res) >= Globally + then + Set_Expr_Staticness (Expr, Get_Expr_Staticness (Res)); + Set_Type (Expr, Get_Type (Res)); + end if; + -- When possible, use the type of the expression as the type of the -- qualified expression. -- TODO: also handle unbounded subtypes, but only if this is a proper |