A code for detecting illegal OTHERS clause is handles both
component_association and iterated_component_association, whose choice
list must be accessed with Choices and Discrete_Choices, respectively.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* sem_aggr.adb (Resolve_Array_Aggregate): Use Choice_List, which
internally calls either Choice or Discrete_Choices, depending on
the context.
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -1837,7 +1837,7 @@ package body Sem_Aggr is
if Others_Present and then not Others_Allowed then
Error_Msg_N
("OTHERS choice not allowed here",
- First (Choices (First (Component_Associations (N)))));
+ First (Choice_List (First (Component_Associations (N)))));
return Failure;
end if;