diff options
author | Javier Miranda <miranda@adacore.com> | 2020-08-28 09:24:22 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-10-23 04:24:48 -0400 |
commit | 4d245fdaf742b468bce03034c47b82f51ce6282c (patch) | |
tree | 23f9d2b3d2fa3985791305f84eb5e737974943ba /gcc/ada | |
parent | 70b590e2481f9a887009e51396727659f49b0def (diff) | |
download | gcc-4d245fdaf742b468bce03034c47b82f51ce6282c.zip gcc-4d245fdaf742b468bce03034c47b82f51ce6282c.tar.gz gcc-4d245fdaf742b468bce03034c47b82f51ce6282c.tar.bz2 |
[Ada] Spurious errors on tagged types with renamed subprograms
gcc/ada/
* sem_ch3.adb (Check_Abstract_Overriding): Subprogram renamings
cannot be overridden.
(Derive_Subprogram): Enable setting attribute
Requires_Overriding on functions with controlling access results
of record extensions with a null extension part require
overriding (AI95-00391/06).
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/sem_ch3.adb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index cfef7c7a..269818a 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -10876,6 +10876,13 @@ package body Sem_Ch3 is then null; + -- Subprogram renamings cannot be overridden + + elsif Comes_From_Source (Subp) + and then Present (Alias (Subp)) + then + null; + else Error_Msg_NE ("type must be declared abstract or & overridden", @@ -15726,7 +15733,9 @@ package body Sem_Ch3 is null; -- Ada 2005 (AI-228): Calculate the "require overriding" and "abstract" - -- properties of the subprogram, as defined in RM-3.9.3(4/2-6/2). + -- properties of the subprogram, as defined in RM-3.9.3(4/2-6/2). Note + -- that functions with controlling access results of record extensions + -- with a null extension part require overriding (AI95-00391/06). -- Ada 202x (AI12-0042): Similarly, set those properties for -- implementing the rule of RM 7.3.2(6.1/4). @@ -15744,8 +15753,7 @@ package body Sem_Ch3 is and then Ekind (Etype (New_Subp)) = E_Anonymous_Access_Type and then Designated_Type (Etype (New_Subp)) = - Derived_Type - and then not Is_Null_Extension (Derived_Type)) + Derived_Type) or else (Comes_From_Source (Alias (New_Subp)) and then Is_EVF_Procedure (Alias (New_Subp))) |