aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-12-22 08:09:55 +0100
committerTristan Gingold <tgingold@free.fr>2016-12-22 08:09:55 +0100
commit88981bf9b355d27acf86718aa60d80582a9620db (patch)
treea4998d1f00871b37f7ce63d3798f0ddd32a15050 /src/vhdl
parentfa43f8ba1c4a9056950029e2094d8469f9ad240e (diff)
downloadghdl-88981bf9b355d27acf86718aa60d80582a9620db.tar.gz
ghdl-88981bf9b355d27acf86718aa60d80582a9620db.tar.bz2
ghdl-88981bf9b355d27acf86718aa60d80582a9620db.zip
Improve error message for #243
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/sem_names.adb20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vhdl/sem_names.adb b/src/vhdl/sem_names.adb
index 474bd799d..b7c4a41b9 100644
--- a/src/vhdl/sem_names.adb
+++ b/src/vhdl/sem_names.adb
@@ -3821,6 +3821,26 @@ package body Sem_Names is
end if;
end loop;
if Res = Null_Iir then
+ -- Specific error message for a non-visible enumeration
+ -- literal.
+ if (Get_Kind (Get_Base_Type (A_Type))
+ = Iir_Kind_Enumeration_Type_Definition)
+ and then Kind_In (Name, Iir_Kind_Simple_Name,
+ Iir_Kind_Character_Literal)
+ then
+ Res := Find_Name_In_List (Get_Enumeration_Literal_List
+ (Get_Base_Type (A_Type)),
+ Get_Identifier (Name));
+ if Res /= Null_Iir then
+ Error_Msg_Sem
+ (+Name, "enumeration literal %i is not visible "
+ & "(add a use clause)", +Name);
+ -- Keep the literal as result.
+ end if;
+ end if;
+ end if;
+
+ if Res = Null_Iir then
Error_Not_Match (Name, A_Type);
return Create_Error_Expr (Name, A_Type);
elsif Is_Overload_List (Res) then