aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2020-11-06 18:09:44 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2020-11-30 09:16:16 -0500
commitf456de4c432c6f44cc0de9ccc19a4ff4eadb8f9c (patch)
treeb8d535d35e75c449a2e399672c55504829957897
parentc161b39d051553dc4e6c1de2616049c090a976bb (diff)
downloadgcc-f456de4c432c6f44cc0de9ccc19a4ff4eadb8f9c.zip
gcc-f456de4c432c6f44cc0de9ccc19a4ff4eadb8f9c.tar.gz
gcc-f456de4c432c6f44cc0de9ccc19a4ff4eadb8f9c.tar.bz2
[Ada] Add continuation message when others choice not allowed
gcc/ada/ * sem_aggr.adb (Resolve_Array_Aggregate): Improve error message.
-rw-r--r--gcc/ada/sem_aggr.adb13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 1ba5870..5a1f8c4 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -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