diff options
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r-- | gcc/ada/sem_ch6.adb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 3dbf782b60b..a9f84d34faa 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -1641,10 +1641,13 @@ package body Sem_Ch6 is -- The type must be completed in the current package. This -- is checked at the end of the package declaraton, when - -- Taft amemdment types are identified. + -- Taft-amendment types are identified. If the return type + -- is class-wide, there is no required check, the type can + -- be a bona fide TAT. if Ekind (Scope (Current_Scope)) = E_Package and then In_Private_Part (Scope (Current_Scope)) + and then not Is_Class_Wide_Type (Typ) then Append_Elmt (Designator, Private_Dependents (Typ)); end if; @@ -3415,14 +3418,17 @@ package body Sem_Ch6 is -- Ada 2005 (AI-251): If the return type is abstract, verify that -- the subprogram is abstract also. This does not apply to renaming - -- declarations, where abstractness is inherited. + -- declarations, where abstractness is inherited, and to subprogram + -- bodies generated for stream operations, which become renamings as + -- bodies. -- In case of primitives associated with abstract interface types -- the check is applied later (see Analyze_Subprogram_Declaration). - if not Nkind_In (Parent (N), N_Subprogram_Renaming_Declaration, - N_Abstract_Subprogram_Declaration, - N_Formal_Abstract_Subprogram_Declaration) + if not Nkind_In (Original_Node (Parent (N)), + N_Subprogram_Renaming_Declaration, + N_Abstract_Subprogram_Declaration, + N_Formal_Abstract_Subprogram_Declaration) then if Is_Abstract_Type (Etype (Designator)) and then not Is_Interface (Etype (Designator)) |