]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Accept aliased parameters in Exceptional_Cases
authorPiotr Trojanek <trojanek@adacore.com>
Thu, 2 Mar 2023 14:09:24 +0000 (15:09 +0100)
committerMarc Poulhiès <poulhies@adacore.com>
Thu, 25 May 2023 07:44:15 +0000 (09:44 +0200)
Aliased parameters, just like parameters by-reference types, can safely
appear in consequences of Exceptional_Cases aspect.

gcc/ada/

* sem_res.adb (Resolve_Entity_Name): Allow aliased parameters; tune
error message.

gcc/ada/sem_res.adb

index 4e49a0a1473b8456bf30c98c3110863622095af0..17228689364810edf784e97d51700ae0daf1a8b5 100644 (file)
@@ -8087,6 +8087,7 @@ package body Sem_Res is
               and then Within_Exceptional_Cases_Consequence (N)
               and then not Is_Attribute_Old (Parent (N))
               and then not Is_By_Reference_Type (Etype (E))
+              and then not Is_Aliased (E)
             then
                if Ekind (E) = E_Out_Parameter then
                   Error_Msg_N
@@ -8098,7 +8099,7 @@ package body Sem_Res is
                        "in consequence of Exceptional_Cases", N);
                end if;
                Error_Msg_N
-                 ("\only parameters of by-reference types are allowed", N);
+                 ("\only parameters passed by reference are allowed", N);
             end if;
 
             --  Check for possible elaboration issues with respect to reads of