From: Ed Schonberg Date: Wed, 28 May 2008 15:56:02 +0000 (+0200) Subject: sem_res.adb (Valid_Conversion): An anonymous access_to_subprogram type has a deeper... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c147ac264f3b123440f9c7b82f93f2adba3b0fda;p=gcc.git sem_res.adb (Valid_Conversion): An anonymous access_to_subprogram type has a deeper level than any master only... 2008-05-28 Ed Schonberg * sem_res.adb (Valid_Conversion): An anonymous access_to_subprogram type has a deeper level than any master only when it is the type of an access parameter. From-SVN: r136113 --- diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index d1f2cefc803..b6c72b44cde 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -9434,7 +9434,9 @@ package body Sem_Res is end if; end; - -- Subprogram access types + -- access to subprogram types. If the operand is an access parameter, + -- the type has a deeper accessibility that any master, and cannot + -- be assigned. elsif (Ekind (Target_Type) = E_Access_Subprogram_Type or else @@ -9443,6 +9445,8 @@ package body Sem_Res is then if Ekind (Base_Type (Opnd_Type)) = E_Anonymous_Access_Subprogram_Type + and then Is_Entity_Name (Operand) + and then Ekind (Entity (Operand)) = E_In_Parameter then Error_Msg_N ("illegal attempt to store anonymous access to subprogram", @@ -9452,13 +9456,9 @@ package body Sem_Res is "(RM 3.10.2 (13))", Operand); - if Is_Entity_Name (Operand) - and then Ekind (Entity (Operand)) = E_In_Parameter - then - Error_Msg_NE - ("\use named access type for& instead of access parameter", - Operand, Entity (Operand)); - end if; + Error_Msg_NE + ("\use named access type for& instead of access parameter", + Operand, Entity (Operand)); end if; -- Check that the designated types are subtype conformant