aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2022-06-16 05:41:34 +0200
committerTristan Gingold <tgingold@free.fr>2022-06-16 05:41:34 +0200
commit4e816c37af61b6c6dc0a13020a189bc3d8d7dc39 (patch)
treef320140616f852be93f29873850a24640910bad5 /src
parent5f1628d8f2bd22eac902378db65ec3280b5f1c51 (diff)
downloadghdl-4e816c37af61b6c6dc0a13020a189bc3d8d7dc39.tar.gz
ghdl-4e816c37af61b6c6dc0a13020a189bc3d8d7dc39.tar.bz2
ghdl-4e816c37af61b6c6dc0a13020a189bc3d8d7dc39.zip
vhdl-sem_names: handle element and subtype attributes for type conv.
Fix #2097
Diffstat (limited to 'src')
-rw-r--r--src/vhdl/vhdl-sem_names.adb48
1 files changed, 26 insertions, 22 deletions
diff --git a/src/vhdl/vhdl-sem_names.adb b/src/vhdl/vhdl-sem_names.adb
index c9608f2c2..3ecaeb6f3 100644
--- a/src/vhdl/vhdl-sem_names.adb
+++ b/src/vhdl/vhdl-sem_names.adb
@@ -2979,29 +2979,33 @@ package body Vhdl.Sem_Names is
Assoc_Chain := Get_Association_Chain (Name);
Actual := Get_One_Actual (Assoc_Chain);
- if Kind_In (Prefix,
- Iir_Kind_Type_Declaration, Iir_Kind_Subtype_Declaration)
- then
- -- A type conversion. The prefix is a type mark.
- declare
- In_Formal : Boolean;
- begin
- if Actual = Null_Iir then
- -- More than one actual. Keep only the first.
- Error_Msg_Sem
- (+Name, "type conversion allows only one expression");
- In_Formal := False;
- else
- In_Formal := Get_In_Formal_Flag (Assoc_Chain);
- end if;
+ case Get_Kind (Prefix) is
+ when Iir_Kind_Type_Declaration
+ | Iir_Kind_Subtype_Declaration
+ | Iir_Kind_Subtype_Attribute
+ | Iir_Kind_Element_Attribute =>
+ -- A type conversion. The prefix is a type mark.
+ declare
+ In_Formal : Boolean;
+ begin
+ if Actual = Null_Iir then
+ -- More than one actual. Keep only the first.
+ Error_Msg_Sem
+ (+Name, "type conversion allows only one expression");
+ In_Formal := False;
+ else
+ In_Formal := Get_In_Formal_Flag (Assoc_Chain);
+ end if;
- -- This is certainly the easiest case: the prefix is not
- -- overloaded, so the result can be computed.
- Set_Named_Entity
- (Name, Sem_Type_Conversion (Name, Prefix, Actual, In_Formal));
- end;
- return;
- end if;
+ -- This is certainly the easiest case: the prefix is not
+ -- overloaded, so the result can be computed.
+ Set_Named_Entity
+ (Name, Sem_Type_Conversion (Name, Prefix, Actual, In_Formal));
+ end;
+ return;
+ when others =>
+ null;
+ end case;
-- Select between slice or indexed name.
Actual_Expr := Null_Iir;