https://gcc.gnu.org/g:0cdb59dcce86c060d828d751b666757edb6af0b3

commit r16-3707-g0cdb59dcce86c060d828d751b666757edb6af0b3
Author: Ronan Desplanques <[email protected]>
Date:   Fri Aug 8 14:57:19 2025 +0200

    ada: Fix comment in Find_Type_Name
    
    The comment this patch changes was made incorrect by the possibility of
    completing an incomplete view with a private type declaration in Ada
    2012. To avoid any possible confusion, this patch brings the comment up
    to date.
    
    gcc/ada/ChangeLog:
    
            * sem_ch3.adb (Find_Type_Name): Fix comment.

Diff:
---
 gcc/ada/sem_ch3.adb | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 96429361115e..bdd23aa276fd 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -18747,7 +18747,11 @@ package body Sem_Ch3 is
             Enter_Name (Id);
             New_Id := Id;
 
-         --  Check invalid completion of private or incomplete type
+         --  Check invalid completion of private or incomplete type. The
+         --  completion of an incomplete view must be a non-incomplete type
+         --  declaration (RM 3.10.1 (3/3)) and the completion of a partial view
+         --  must be a full type declaration (RM 7.3 (4)). Before Ada 2012, a
+         --  full type declaration is needed in the two cases.
 
          elsif Nkind (N) not in N_Full_Type_Declaration
                               | N_Task_Type_Declaration
@@ -18758,8 +18762,6 @@ package body Sem_Ch3 is
                or else Nkind (N) not in N_Private_Type_Declaration
                                       | N_Private_Extension_Declaration)
          then
-            --  Completion must be a full type declarations (RM 7.3(4))
-
             Error_Msg_Sloc := Sloc (Prev);
             Error_Msg_NE ("invalid completion of }", Id, Prev);

Reply via email to