aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2021-12-07 22:10:53 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-01-06 17:11:36 +0000
commitffbc891aaa97892303bded2b1c07b2bf6034a679 (patch)
tree5bc35ec8d3c58ab35fa371e18b8bf286a0a92ca3 /gcc
parent5bad97d7445d679921e87bc0f94286c3ade02d27 (diff)
downloadgcc-ffbc891aaa97892303bded2b1c07b2bf6034a679.zip
gcc-ffbc891aaa97892303bded2b1c07b2bf6034a679.tar.gz
gcc-ffbc891aaa97892303bded2b1c07b2bf6034a679.tar.bz2
[Ada] Fix spurious error on instantiation with Text_IO name
gcc/ada/ * sem_ch8.adb (Analyze_Package_Renaming): Do not check for Text_IO special units when the name of the renaming is a generic instance, which is the case for package instantiations in the GNAT model.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_ch8.adb13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 8ee3496..a70077a 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -1594,9 +1594,18 @@ package body Sem_Ch8 is
return;
end if;
- -- Check for Text_IO special unit (we may be renaming a Text_IO child)
+ -- Check for Text_IO special units (we may be renaming a Text_IO child),
+ -- but make sure not to catch renamings generated for package instances
+ -- that have nothing to do with them but are nevertheless homonyms.
- Check_Text_IO_Special_Unit (Name (N));
+ if Is_Entity_Name (Name (N))
+ and then Present (Entity (Name (N)))
+ and then Is_Generic_Instance (Entity (Name (N)))
+ then
+ null;
+ else
+ Check_Text_IO_Special_Unit (Name (N));
+ end if;
if Current_Scope /= Standard_Standard then
Set_Is_Pure (New_P, Is_Pure (Current_Scope));