diff options
author | Ed Schonberg <schonberg@adacore.com> | 2020-06-11 11:34:26 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-07-16 05:18:14 -0400 |
commit | 875a00faca1e15e72aca02c323c0459b50d96b89 (patch) | |
tree | ab6a11fa90dc436c4cc40e8c35f904033d6330f5 /gcc/ada | |
parent | 4c81868d073c493ca07d60b30dffc9a864304c77 (diff) | |
download | gcc-875a00faca1e15e72aca02c323c0459b50d96b89.zip gcc-875a00faca1e15e72aca02c323c0459b50d96b89.tar.gz gcc-875a00faca1e15e72aca02c323c0459b50d96b89.tar.bz2 |
[Ada] Spurious error in instance nested in formal package
gcc/ada/
* sem_ch12.adb (Load_Parent_Of_Generic): If an ancestor is an
instance whose source appears within a formal package of the
current unit, there is no body of the ancestor needed to
complete the current generic compilation.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/sem_ch12.adb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 4307111..b3a4ad4 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -14292,6 +14292,21 @@ package body Sem_Ch12 is exit; + -- If an ancestor of the generic comes from a formal package + -- there is no source for the ancestor body. This is detected + -- by examining the scope of the ancestor and its declaration. + -- The body, if any is needed, will be available when the + -- current unit (containing a formal package) is instantiated. + + elsif Nkind (True_Parent) = N_Package_Specification + and then Present (Generic_Parent (True_Parent)) + and then Nkind + (Original_Node (Unit_Declaration_Node + (Scope (Generic_Parent (True_Parent))))) + = N_Formal_Package_Declaration + then + return; + else True_Parent := Parent (True_Parent); end if; |