diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-09-28 03:34:51 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-09-28 03:34:51 +0200 |
commit | 67890d248c62a874f11145d489efda8edf5dcc8b (patch) | |
tree | e7173599031e9caff905f720f0412f0f09f50903 | |
parent | fcd2c2d7f5745f97534d60fb7c6aa60a8a7ca287 (diff) | |
download | ghdl-67890d248c62a874f11145d489efda8edf5dcc8b.tar.gz ghdl-67890d248c62a874f11145d489efda8edf5dcc8b.tar.bz2 ghdl-67890d248c62a874f11145d489efda8edf5dcc8b.zip |
Set type of range expression from the type mark (if present).
Fix issue #156
-rw-r--r-- | src/vhdl/sem_expr.adb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb index 902162d12..027ed5e20 100644 --- a/src/vhdl/sem_expr.adb +++ b/src/vhdl/sem_expr.adb @@ -664,11 +664,14 @@ package body Sem_Expr is Set_Expr_Staticness (Expr, Min (Get_Expr_Staticness (Left), Get_Expr_Staticness (Right))); - if A_Type /= Null_Iir - and then Are_Types_Compatible (Expr_Type, A_Type) = Not_Compatible - then - Error_Msg_Sem (+Expr, "type of range doesn't match expected type"); - return Null_Iir; + if A_Type /= Null_Iir then + if Are_Types_Compatible (Expr_Type, A_Type) = Not_Compatible then + Error_Msg_Sem (+Expr, "type of range doesn't match expected type"); + return Null_Iir; + end if; + + -- Use A_TYPE for the type of the expression. + Expr_Type := A_Type; end if; Set_Type (Expr, Expr_Type); |