aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch4.adb
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2018-05-24 13:06:28 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-24 13:06:28 +0000
commit24e959661f42da6c5c65de96a7c9d88082c3ffd8 (patch)
tree575ba6090c393eb39e9941dc6668e309bb1fcd35 /gcc/ada/sem_ch4.adb
parent5a5925ee30a8f8b43d045726aa7b2a82c6a6af61 (diff)
downloadgcc-24e959661f42da6c5c65de96a7c9d88082c3ffd8.zip
gcc-24e959661f42da6c5c65de96a7c9d88082c3ffd8.tar.gz
gcc-24e959661f42da6c5c65de96a7c9d88082c3ffd8.tar.bz2
[Ada] Missing error on illegal access to discriminant
The compiler does not report an error on the illegal access to a renamed discriminant when the actual object is a parameter of a subprogram. 2018-05-24 Javier Miranda <miranda@adacore.com> gcc/ada/ * sem_ch3.adb (Is_Visible_Component): For untagged types add missing check for renamed discriminants. * sem_ch4.adb (Analyze_Overloaded_Selected_Component, Analyze_Selected_Component, Check_Misspelled_Selector): For calls to Is_Visible_Component pass the associated selector node to allow checking renamed discriminants on untagged types. gcc/testsuite/ * gnat.dg/discr52.adb: New testcase. From-SVN: r260664
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r--gcc/ada/sem_ch4.adb6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 5d2e81b..f177417 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -3905,7 +3905,7 @@ package body Sem_Ch4 is
Comp := First_Entity (T);
while Present (Comp) loop
if Chars (Comp) = Chars (Sel)
- and then Is_Visible_Component (Comp)
+ and then Is_Visible_Component (Comp, Sel)
then
-- AI05-105: if the context is an object renaming with
@@ -5324,7 +5324,7 @@ package body Sem_Ch4 is
Comp := First_Component (Base_Type (Prefix_Type));
while Present (Comp) loop
if Chars (Comp) = Chars (Sel)
- and then Is_Visible_Component (Comp)
+ and then Is_Visible_Component (Comp, Sel)
then
Set_Entity_With_Checks (Sel, Comp);
Generate_Reference (Comp, Sel);
@@ -6031,7 +6031,7 @@ package body Sem_Ch4 is
Comp := First_Entity (Prefix);
while Nr_Of_Suggestions <= Max_Suggestions and then Present (Comp) loop
- if Is_Visible_Component (Comp) then
+ if Is_Visible_Component (Comp, Sel) then
if Is_Bad_Spelling_Of (Chars (Comp), Chars (Sel)) then
Nr_Of_Suggestions := Nr_Of_Suggestions + 1;