diff options
author | Javier Miranda <miranda@adacore.com> | 2022-08-23 11:28:43 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2022-09-12 10:16:49 +0200 |
commit | dad0ebe674d495a7e032a123d2d60c090729ef2c (patch) | |
tree | 5c2d16eee13a4a38955ec4766fae816f0ef38944 /gcc/ada/sem_ch3.adb | |
parent | 3fa66b95570a125fd35d5721c9eb08d975f73e82 (diff) | |
download | gcc-dad0ebe674d495a7e032a123d2d60c090729ef2c.zip gcc-dad0ebe674d495a7e032a123d2d60c090729ef2c.tar.gz gcc-dad0ebe674d495a7e032a123d2d60c090729ef2c.tar.bz2 |
[Ada] Revert "Enforce matching of extra formals"
This reverts commit 51abc0cc8691daecd7cec8372e4988e9f3f1913c.
Diffstat (limited to 'gcc/ada/sem_ch3.adb')
-rw-r--r-- | gcc/ada/sem_ch3.adb | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 99e188d..00c2e67 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -1318,8 +1318,7 @@ package body Sem_Ch3 is Check_Restriction (No_Access_Subprograms, T_Def); - -- Addition of extra formals must be delayed till the freeze point so - -- that we know the convention. + Create_Extra_Formals (Desig_Type); end Access_Subprogram_Declaration; ---------------------------- @@ -11769,9 +11768,11 @@ package body Sem_Ch3 is Insert_Before (Typ_Decl, Decl); Analyze (Decl); - -- At first sight we could add here the extra formals of an access to - -- subprogram; however, it must delayed till the freeze point so that - -- we know the convention. + -- If an access to subprogram, create the extra formals + + if Present (Acc_Def) then + Create_Extra_Formals (Designated_Type (Anon_Access)); + end if; if Nkind (Comp_Def) = N_Component_Definition then Rewrite (Comp_Def, @@ -16032,12 +16033,12 @@ package body Sem_Ch3 is Next_Formal (Formal); end loop; - -- Extra formals are shared between the parent subprogram and this - -- internal entity built by Derive_Subprogram (implicit in the above - -- copy of formals), unless the parent type is a limited interface type; - -- hence we must inherit also the reference to the first extra formal. - -- When the parent type is an interface, the extra formals will be added - -- when the tagged type is frozen (see Expand_Freeze_Record_Type). + -- Extra formals are shared between the parent subprogram and the + -- derived subprogram (implicit in the above copy of formals), unless + -- the parent type is a limited interface type; hence we must inherit + -- also the reference to the first extra formal. When the parent type is + -- an interface the extra formals will be added when the subprogram is + -- frozen (see Freeze.Freeze_Subprogram). if not Is_Limited_Interface (Parent_Type) then Set_Extra_Formals (New_Subp, Extra_Formals (Parent_Subp)); |