aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2012-01-30 13:15:42 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2012-01-30 13:15:42 +0100
commite11be5ac78851c754c30299dfccda58a6241d9c3 (patch)
tree8ac371cddfaeb7a834dc3556e7b91c40db267aa1 /gcc
parentf849ad6ff8acbccd10cd3f3e2277ba1fc9a0cb66 (diff)
downloadgcc-e11be5ac78851c754c30299dfccda58a6241d9c3.zip
gcc-e11be5ac78851c754c30299dfccda58a6241d9c3.tar.gz
gcc-e11be5ac78851c754c30299dfccda58a6241d9c3.tar.bz2
re PR ada/15846 (Illegal program not detected, self renames)
2012-01-30 Javier Miranda <miranda@adacore.com> PR ada/15846 * sem_ch8.adb (Analyze_Subprogram_Renaming): Handle self-renaming when the renamed entity is referenced using its expanded name. From-SVN: r183713
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch8.adb7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 28edc2f..94f369a 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2011, Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2012, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -2665,7 +2665,10 @@ package body Sem_Ch8 is
if not Is_Actual
and then (Old_S = New_S
or else (Nkind (Nam) /= N_Expanded_Name
- and then Chars (Old_S) = Chars (New_S)))
+ and then Chars (Old_S) = Chars (New_S))
+ or else (Nkind (Nam) = N_Expanded_Name
+ and then Entity (Prefix (Nam)) = Current_Scope
+ and then Chars (Selector_Name (Nam)) = Chars (New_S)))
then
Error_Msg_N ("subprogram cannot rename itself", N);
end if;