]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix comment in Find_Type_Name
authorRonan Desplanques <desplanques@adacore.com>
Fri, 8 Aug 2025 12:57:19 +0000 (14:57 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 9 Sep 2025 12:39:58 +0000 (14:39 +0200)
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.

gcc/ada/sem_ch3.adb

index 96429361115e23995c43fba32f88e15324d391a1..bdd23aa276fd5ca92b0ddd942f81dc0cb8763386 100644 (file)
@@ -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);