Commit 17cf3985 by Arnaud Charlet

Restore part of patch lost for PR ada/15805:

	* sem_ch3.adb (Analyze_Object_Declaration): Signal an error
	when an access to constant is used to initialize an access
	value.

From-SVN: r130903
parent 3958c9c8
......@@ -2367,6 +2367,20 @@ package body Sem_Ch3 is
Set_Is_True_Constant (Id, True);
-- If the initialization expression is an access to constant,
-- it cannot be used with an access type.
if Is_Access_Type (Etype (E))
and then Is_Access_Constant (Etype (E))
and then Is_Access_Type (T)
and then not Is_Access_Constant (T)
then
Error_Msg_NE ("object of type& cannot be initialized with " &
"an access-to-constant expression",
E,
T);
end if;
-- If we are analyzing a constant declaration, set its completion
-- flag after analyzing the expression.
......
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