diff options
author | Tristan Gingold <tgingold@free.fr> | 2018-11-09 03:50:10 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2018-11-09 03:50:10 +0100 |
commit | 8521efde4b3e3f4ef082608fbd0e4f34d7c38eb6 (patch) | |
tree | af19b296b2c59aec931eb64e5762f61984a2f79a /src/vhdl/sem_expr.adb | |
parent | b043fa31841362c17b2bb937d35a55c544a0a029 (diff) | |
download | ghdl-8521efde4b3e3f4ef082608fbd0e4f34d7c38eb6.tar.gz ghdl-8521efde4b3e3f4ef082608fbd0e4f34d7c38eb6.tar.bz2 ghdl-8521efde4b3e3f4ef082608fbd0e4f34d7c38eb6.zip |
sem_expr: fix reference issue to subtypes.
Diffstat (limited to 'src/vhdl/sem_expr.adb')
-rw-r--r-- | src/vhdl/sem_expr.adb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb index 3ea703f38..e08fc5940 100644 --- a/src/vhdl/sem_expr.adb +++ b/src/vhdl/sem_expr.adb @@ -4825,7 +4825,13 @@ package body Sem_Expr is if Expr = Null_Iir then return; end if; - Expr_Type := Get_Type (Expr); + + -- Use the base type; EXPR may define its own subtype (like in + -- qualified expression with forwarding) which must not be referenced + -- above it. In any case, that also makes sense: we need to deal with + -- types, not with subtypes. + Expr_Type := Get_Base_Type (Get_Type (Expr)); + pragma Assert (Expr_Type /= Null_Iir); Result_Type := Compatible_Types_Intersect (Atype, Expr_Type); if Atype /= Null_Iir and then Is_Overload_List (Atype) then |