From 6ed3a69222597c8660d8d9ad9da1e06c3d11474f Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 1 Feb 2020 17:17:43 +0100 Subject: vhdl-sem_assocs: check that interface of function conv is a constant. Fix #1123 --- src/vhdl/vhdl-sem_assocs.adb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/vhdl') diff --git a/src/vhdl/vhdl-sem_assocs.adb b/src/vhdl/vhdl-sem_assocs.adb index 47f45c380..74faad959 100644 --- a/src/vhdl/vhdl-sem_assocs.adb +++ b/src/vhdl/vhdl-sem_assocs.adb @@ -1325,10 +1325,23 @@ package body Vhdl.Sem_Assocs is if Is_Valid_Conversion (Conv, Res_Base_Type, Param_Base_Type) then Res := Conv; else - Res := Null_Iir; Error_Msg_Sem (+Loc, "conversion function or type does not match"); + return Null_Iir; end if; end if; + + if Get_Kind (Res) = Iir_Kind_Function_Call then + declare + Imp : constant Iir := Get_Implementation (Res); + Inter : constant Iir := Get_Interface_Declaration_Chain (Imp); + begin + if Get_Kind (Inter) /= Iir_Kind_Interface_Constant_Declaration then + Error_Msg_Sem + (+Loc, "interface of function must be a constant interface"); + end if; + end; + end if; + return Res; end Extract_Conversion; -- cgit v1.2.3