[Ada] Adjust previous change to Rewrite_As_Renaming

gcc/ada/

	* exp_ch3.adb (Expand_N_Object_Declaration.Rewrite_As_Renaming):
	Do not rewrite if the declaration has got constraints.
	* sinfo.ads (Case Expression Alternative): Fix typo.
This commit is contained in:
Eric Botcazou 2022-05-29 13:35:57 +02:00 committed by Pierre-Marie de Rodat
parent 2cad8a59a8
commit 0896e2b79a
2 changed files with 14 additions and 7 deletions

View File

@ -6865,13 +6865,20 @@ package body Exp_Ch3 is
and then and then
OK_To_Rename_Entity_Name (Prefix (Expr_Q))))); OK_To_Rename_Entity_Name (Prefix (Expr_Q)))));
begin begin
-- ??? Return False if there are any aspect specifications, because return Result
-- otherwise we duplicate that corresponding implicit attribute
-- definition, and call Insert_Action, which has no place to insert
-- the attribute definition. The attribute definition is stored in
-- Aspect_Rep_Item, which is not a list.
return Result and then No (Aspect_Specifications (N)); -- The declaration cannot be rewritten if it has got constraints,
-- in other words the nominal subtype must be unconstrained.
and then Is_Entity_Name (Original_Node (Obj_Def))
-- ??? Return False if there are any aspect specifications, because
-- otherwise we duplicate that corresponding implicit attribute
-- definition, and call Insert_Action, which has no place to insert
-- the attribute definition. The attribute definition is stored in
-- Aspect_Rep_Item, which is not a list.
and then No (Aspect_Specifications (N));
end Rewrite_As_Renaming; end Rewrite_As_Renaming;
-- Local variables -- Local variables

View File

@ -4651,7 +4651,7 @@ package Sinfo is
-- Note: The Actions field temporarily holds any actions associated with -- Note: The Actions field temporarily holds any actions associated with
-- evaluation of the Expression. During expansion of the case expression -- evaluation of the Expression. During expansion of the case expression
-- these actions are wrapped into an N_Expressions_With_Actions node -- these actions are wrapped into an N_Expression_With_Actions node
-- replacing the original expression. -- replacing the original expression.
-- Note: this node never appears in the tree passed to the back end, -- Note: this node never appears in the tree passed to the back end,