diff options
Diffstat (limited to 'gcc/ada/sem_ch13.adb')
-rw-r--r-- | gcc/ada/sem_ch13.adb | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 4c8c650..476503c 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -2304,12 +2304,48 @@ package body Sem_Ch13 is if Nkind (Expr) = N_Aggregate then - -- Component associations are not allowed in the - -- aspect expression aggregate. + -- Component associations in the aggregate must be a + -- parameter name followed by a static boolean + -- expression. if Present (Component_Associations (Expr)) then - Error_Msg_N ("illegal aspect % expression", Expr); - else + declare + Assoc : Node_Id := + First (Component_Associations (Expr)); + begin + while Present (Assoc) loop + if List_Length (Choices (Assoc)) = 1 then + Analyze_Relaxed_Parameter + (E, First (Choices (Assoc)), Seen); + + if Inside_A_Generic then + Preanalyze_And_Resolve + (Expression (Assoc), Any_Boolean); + else + Analyze_And_Resolve + (Expression (Assoc), Any_Boolean); + end if; + + if not Is_OK_Static_Expression + (Expression (Assoc)) + then + Error_Msg_N + ("expression of aspect %" & + "must be static", Aspect); + end if; + + else + Error_Msg_N + ("illegal aspect % expression", Expr); + end if; + Next (Assoc); + end loop; + end; + end if; + + -- Expressions of the aggregate are parameter names + + if Present (Expressions (Expr)) then declare Param : Node_Id := First (Expressions (Expr)); |