From ccd0ed95a86f0034daa452b0bb82b15ab47b284a Mon Sep 17 00:00:00 2001 From: Pierre-Marie de Rodat Date: Fri, 29 Sep 2017 13:22:45 +0000 Subject: [multiple changes] 2017-09-29 Justin Squirek * sem_ch8.adb (Analyze_Use_Package): Add sanity check to avoid circularities in the use-clause chain. 2017-09-29 Javier Miranda * sem_ch3.adb (Replace_Components): Update references to discriminants located in variant parts inherited from the parent type. 2017-09-29 Javier Miranda * exp_ch5.adb (Expand_Assign_Record): Do not generate code to copy discriminants if the target is an Unchecked_Union record type. 2017-09-29 Ed Schonberg * sem_aggr.adb (Resolve_Record_Aggregate): Reject the use of an iterated component association in an aggregate for a record type. 2017-09-29 Piotr Trojanek * make.adb: Minor whitespace fixes. * libgnat/s-resfil.ads: Minor reformatting. From-SVN: r253288 --- gcc/ada/sem_aggr.adb | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'gcc/ada/sem_aggr.adb') diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index c885ce9..ad6e1ea 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -4108,15 +4108,22 @@ package body Sem_Aggr is begin Assoc := First (Component_Associations (N)); while Present (Assoc) loop - if List_Length (Choices (Assoc)) > 1 then - Check_SPARK_05_Restriction - ("component association in record aggregate must " - & "contain a single choice", Assoc); - end if; + if Nkind (Assoc) = N_Iterated_Component_Association then + Error_Msg_N ("iterated component association can only " + & "appear in an array aggregate", N); + raise Unrecoverable_Error; - if Nkind (First (Choices (Assoc))) = N_Others_Choice then - Check_SPARK_05_Restriction - ("record aggregate cannot contain OTHERS", Assoc); + else + if List_Length (Choices (Assoc)) > 1 then + Check_SPARK_05_Restriction + ("component association in record aggregate must " + & "contain a single choice", Assoc); + end if; + + if Nkind (First (Choices (Assoc))) = N_Others_Choice then + Check_SPARK_05_Restriction + ("record aggregate cannot contain OTHERS", Assoc); + end if; end if; Assoc := Next (Assoc); -- cgit v1.1