https://gcc.gnu.org/g:84119759ec0f312fb4a022a718254fa311ebf474

commit r16-4131-g84119759ec0f312fb4a022a718254fa311ebf474
Author: Ronan Desplanques <[email protected]>
Date:   Tue Sep 16 10:12:29 2025 +0200

    ada: Fix error message about limited extensions
    
    Consider the following package:
    
        package P is
           type T1 is tagged limited null record;
    
           type T2 is new T1 with private;
        private
    
           type T2 is limited new T1 with null record;
        end P;
    
    It should be rejected because of ARM 7.3 (10.1/3). Before this patch,
    GNAT did reject it, with the following error message:
    
        full view of non-limited extension cannot be limited
    
    This message is not right because the partial view of T2 here *is*
    limited even if it doesn't have an explicit limited keyword in its
    declaration. This patch changes the error message to something that's a
    better match for ARM 7.3 (10.1/3).
    
    This patch also tweaks another related error message and substitutes
    a mention of ARM 7.3 (10.1/3) for the Ada Issue it originated from in a
    comment.
    
    gcc/ada/ChangeLog:
    
            * sem_ch3.adb (Process_Full_View): Fix error message.

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

diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index c261305f286d..9ca77089d1a3 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -21993,7 +21993,7 @@ package body Sem_Ch3 is
          end if;
       end if;
 
-      --  AI-419: verify that the use of "limited" is consistent
+      --  RM 7.3 (10.1/3): verify that the use of "limited" is consistent
 
       declare
          Orig_Decl : constant Node_Id := Original_Node (N);
@@ -22009,7 +22009,9 @@ package body Sem_Ch3 is
               and then Limited_Present (Type_Definition (Orig_Decl))
             then
                Error_Msg_N
-                 ("full view of non-limited extension cannot be limited", N);
+                 ("full view of implicitly limited extension must be "
+                  & "implicitly limited",
+                  N);
 
             --  Conversely, if the partial view carries the limited keyword,
             --  the full view must as well, even if it may be redundant.
@@ -22018,7 +22020,8 @@ package body Sem_Ch3 is
               and then not Limited_Present (Type_Definition (Orig_Decl))
             then
                Error_Msg_N
-                 ("full view of limited extension must be explicitly limited",
+                 ("full view of explicitly limited extension must be "
+                  & "explicitly limited",
                   N);
             end if;
          end if;

Reply via email to