Access parameters are not allowed in specifications of task entries.
Before this patch, the compiler failed to detect that case in accept
statements that were not directly in their task body's scopes. This
patch fixes this issue.
gcc/ada/ChangeLog:
* sem_ch3.adb (Access_Definition): Remove test for task entry context.
* sem_ch6.adb (Process_Formals): Add improved test for task entry
context.
Enclosing_Prot_Type : Entity_Id := Empty;
begin
- if Is_Entry (Current_Scope)
- and then Is_Task_Type (Etype (Scope (Current_Scope)))
- then
- Error_Msg_N ("task entries cannot have access parameters", N);
- return Empty;
- end if;
-
-- Ada 2005: For an object declaration the corresponding anonymous
-- type is declared in the current scope.
-- An access formal type
else
+ if Nkind (Parent (T)) = N_Accept_Statement
+ or else (Nkind (Parent (T)) = N_Entry_Declaration
+ and then Nkind (Context) = N_Task_Definition)
+ then
+ Error_Msg_N
+ ("task entries cannot have access parameters",
+ Parameter_Type (Param_Spec));
+ return;
+ end if;
+
Formal_Type :=
Access_Definition (Related_Nod, Parameter_Type (Param_Spec));