diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2020-01-20 11:24:07 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-06-04 05:11:02 -0400 |
commit | d46b330ddc1dc1c16e9638e144db64df7365a820 (patch) | |
tree | 4375ec4035eb4f2051b37b96b833329798c276ab /gcc | |
parent | 528576de0bd3bf7154952d9b5e7ced2b4ed7f038 (diff) | |
download | gcc-d46b330ddc1dc1c16e9638e144db64df7365a820.zip gcc-d46b330ddc1dc1c16e9638e144db64df7365a820.tar.gz gcc-d46b330ddc1dc1c16e9638e144db64df7365a820.tar.bz2 |
[Ada] Small tweak to special handling of private index types
2020-06-04 Eric Botcazou <ebotcazou@adacore.com>
gcc/ada/
* sem_ch3.adb (Array_Type_Declaration): Apply special handling
of private index types to generic packages and restrict it to
index types defined in the current scope.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_ch3.adb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 29e8964..dcf0701 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -6137,7 +6137,7 @@ package body Sem_Ch3 is end if; -- Add a subtype declaration for each index of private array type - -- declaration whose etype is also private. For example: + -- declaration whose type is also private. For example: -- package Pkg is -- type Index is private; @@ -6147,11 +6147,14 @@ package body Sem_Ch3 is -- This is currently required by the expander for the internally -- generated equality subprogram of records with variant parts in - -- which the etype of some component is such private type. + -- which the type of some component is such a private type. And it + -- also helps semantic analysis in peculiar cases where the array + -- type is referenced from an instance but not the index directly. - if Ekind (Current_Scope) = E_Package + if Is_Package_Or_Generic_Package (Current_Scope) and then In_Private_Part (Current_Scope) and then Has_Private_Declaration (Etype (Index)) + and then Scope (Etype (Index)) = Current_Scope then declare Loc : constant Source_Ptr := Sloc (Def); |