From 6fe280aa0955f78a832d74030b20fe6d64f5d428 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 2 May 2020 09:43:06 +0200 Subject: vhdl-sem_expr: fix handling of overload lists in merge_wildcard_type. Fix #1274 --- src/vhdl/vhdl-sem_expr.adb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/vhdl/vhdl-sem_expr.adb') diff --git a/src/vhdl/vhdl-sem_expr.adb b/src/vhdl/vhdl-sem_expr.adb index 3dd6cd304..51a6549c8 100644 --- a/src/vhdl/vhdl-sem_expr.adb +++ b/src/vhdl/vhdl-sem_expr.adb @@ -5120,16 +5120,21 @@ package body Vhdl.Sem_Expr is return; end if; - -- 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)); + Expr_Type := Get_Type (Expr); if Is_Error (Expr_Type) then return; end if; - pragma Assert (Expr_Type /= Null_Iir); + if not Is_Overload_List (Expr_Type) then + -- Use the base type; EXPR may define its own subtype (like in + -- qualified expression with forwarding) which must not be + -- referenced before it is defined (so by a parent). In any case, + -- that also makes sense: we need to deal with types, not with + -- subtypes. + Expr_Type := Get_Base_Type (Expr_Type); + pragma Assert (Expr_Type /= Null_Iir); + end if; + Result_Type := Compatible_Types_Intersect (Atype, Expr_Type); if Atype /= Null_Iir and then Is_Overload_List (Atype) then Free_Overload_List (Atype); -- cgit v1.2.3