public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED] ada: Accept aliased parameters in Exceptional_Cases
@ 2023-05-25  8:05 Marc Poulhiès
  0 siblings, 0 replies; only message in thread
From: Marc Poulhiès @ 2023-05-25  8:05 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

From: Piotr Trojanek <trojanek@adacore.com>

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.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/sem_res.adb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 4e49a0a1473..17228689364 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -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
-- 
2.40.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-25  8:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25  8:05 [COMMITTED] ada: Accept aliased parameters in Exceptional_Cases Marc Poulhiès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).