aboutsummaryrefslogtreecommitdiffstats
path: root/src/vhdl
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2016-07-29 03:39:10 +0200
committerTristan Gingold <tgingold@free.fr>2016-07-30 07:03:39 +0200
commit46e91341fa5eeeb6d678c703d2d041a45d71de8f (patch)
tree33008d69593c7255caafc71911fd12c567d3465b /src/vhdl
parentf2e0f4caa262f2e04b9ae4d29d28646751039d38 (diff)
downloadghdl-46e91341fa5eeeb6d678c703d2d041a45d71de8f.tar.gz
ghdl-46e91341fa5eeeb6d678c703d2d041a45d71de8f.tar.bz2
ghdl-46e91341fa5eeeb6d678c703d2d041a45d71de8f.zip
Allow alias of literals in strings.
Fix issue #125
Diffstat (limited to 'src/vhdl')
-rw-r--r--src/vhdl/sem_expr.adb6
-rw-r--r--src/vhdl/sem_scopes.adb22
2 files changed, 22 insertions, 6 deletions
diff --git a/src/vhdl/sem_expr.adb b/src/vhdl/sem_expr.adb
index a66e99c1d..c1d445a58 100644
--- a/src/vhdl/sem_expr.adb
+++ b/src/vhdl/sem_expr.adb
@@ -1782,9 +1782,7 @@ package body Sem_Expr is
Decl := Get_Non_Alias_Declaration (Interpretation);
-- It is compatible with operand types ?
- if Get_Kind (Decl) /= Iir_Kind_Function_Declaration then
- raise Internal_Error;
- end if;
+ pragma Assert (Get_Kind (Decl) = Iir_Kind_Function_Declaration);
-- LRM08 12.3 Visibility
-- [...] or all visible declarations denote the same named entity.
@@ -1955,7 +1953,7 @@ package body Sem_Expr is
begin
Inter := Get_Interpretation (Id);
while Valid_Interpretation (Inter) loop
- Decl := Get_Declaration (Inter);
+ Decl := Get_Non_Alias_Declaration (Inter);
if Get_Kind (Decl) = Iir_Kind_Enumeration_Literal
and then Get_Type (Decl) = Etype
then
diff --git a/src/vhdl/sem_scopes.adb b/src/vhdl/sem_scopes.adb
index 6ee061de6..41b0c9ee6 100644
--- a/src/vhdl/sem_scopes.adb
+++ b/src/vhdl/sem_scopes.adb
@@ -559,8 +559,26 @@ package body Sem_Scopes is
-- The hash must have been computed.
pragma Assert (Decl_Hash /= 0);
+ -- LRM02 10.3 Visibility
+ -- Each of two declarations is said to be a /homograph/ of the
+ -- other if both declarations have the same identifier, operator
+ -- symbol, or character literal, and if overloading is allowed for
+ -- at mist one of the two.
+ --
+ -- LRM08 12.3 Visibility
+ -- Each of two declarations is said to be a /homograph/ of the
+ -- other if and only if both declarations have the same
+ -- designator, and they denote different named entities, and
+ -- either overloading is allows for at most one of the two, or
+ -- overloading is allowed for both declarations and they have the
+ -- same parameter and result type profile.
+
+ -- GHDL: here we are in the case when both declarations are
+ -- overloadable. Also, always follow the LRM08 rules as they fix
+ -- issues.
+
-- Find an homograph of this declaration (and also keep the
- -- interpretation just before it in the chain),
+ -- interpretation just before it in the chain).
Homograph := Current_Inter;
Prev_Homograph := No_Name_Interpretation;
while Homograph /= No_Name_Interpretation loop
@@ -578,7 +596,7 @@ package body Sem_Scopes is
return;
end if;
- -- There is an homograph.
+ -- There is an homograph (or the named entity is the same).
if Potentially then
-- Added DECL would be made potentially visible.