Commit 434d3cf1 by Arnaud Charlet

sem_ch5.adb (Analyze_Assignment_Statement): Apply conversion to right-hand side…

sem_ch5.adb (Analyze_Assignment_Statement): Apply conversion to right-hand side when it is an anonymous access_to_subprogram...

2008-08-05  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch5.adb (Analyze_Assignment_Statement): Apply conversion to
	right-hand side when it is an anonymous access_to_subprogram, to force
	static accessibility check when needed.

From-SVN: r138723
parent 8d9509fd
2008-08-05 Thomas Quinot <quinot@adacore.com>
* gsocket.h: Make this file includable in a Nucleus environment, which
does not support sockets.
* socket.c: Remove Nucleus-specific hack.
2008-08-05 Pascal Obry <obry@adacore.com>
* adaint.c: Remove support for readable attribute on vxworks and nucleus
2008-08-05 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb:
(Analyze_Attribute, case 'Result): handle properly the case where some
operand of the expression in a post-condition generates a transient
block.
* sem_ch5.adb (Analyze_Assignment_Statement): Apply conversion to
right-hand side when it is an anonymous access_to_subprogram, to force
static accessibility check when needed.
2008-08-05 Sergey Rybin <rybin@adacore.com>
* gnat_ugn.texi: Changing the description of the gnatcheck metrics
......@@ -581,16 +581,19 @@ package body Sem_Ch5 is
-- Ada 2005 (AI-385): When the lhs type is an anonymous access type,
-- apply an implicit conversion of the rhs to that type to force
-- appropriate static and run-time accessibility checks. This
-- applies as well to anonymous access-to-subprogram types that
-- are component subtypes.
-- appropriate static and run-time accessibility checks. This applies
-- as well to anonymous access-to-subprogram types that are component
-- subtypes or formal parameters.
if Ada_Version >= Ada_05
and then Is_Access_Type (T1)
and then Is_Local_Anonymous_Access (T1)
then
Rewrite (Rhs, Convert_To (T1, Relocate_Node (Rhs)));
Analyze_And_Resolve (Rhs, T1);
if Is_Local_Anonymous_Access (T1)
or else Ekind (T2) = E_Anonymous_Access_Subprogram_Type
then
Rewrite (Rhs, Convert_To (T1, Relocate_Node (Rhs)));
Analyze_And_Resolve (Rhs, T1);
end if;
end if;
-- Ada 2005 (AI-231): Assignment to not null variable
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment