[Ada] Add continuation message when others choice not allowed

gcc/ada/

	* sem_aggr.adb (Resolve_Array_Aggregate): Improve error message.
This commit is contained in:
Yannick Moy 2020-11-06 18:09:44 +01:00 committed by Pierre-Marie de Rodat
parent c161b39d05
commit f456de4c43
1 changed files with 9 additions and 4 deletions

View File

@ -1870,10 +1870,15 @@ package body Sem_Aggr is
-- Test for the validity of an others choice if present
if Others_Present and then not Others_Allowed then
Error_Msg_N
("OTHERS choice not allowed here",
First (Choice_List (First (Component_Associations (N)))));
return Failure;
declare
Others_N : constant Node_Id :=
First (Choice_List (First (Component_Associations (N))));
begin
Error_Msg_N ("OTHERS choice not allowed here", Others_N);
Error_Msg_N ("\qualify the aggregate with a constrained subtype "
& "to provide bounds for it", Others_N);
return Failure;
end;
end if;
-- Protect against cascaded errors