Commit 509a3219 by Ed Schonberg Committed by Arnaud Charlet

sem_ch9.adb (Analyze_Delay_Alternative, [...]): Use the first subtype of the…

sem_ch9.adb (Analyze_Delay_Alternative, [...]): Use the first subtype of the type of the expression to verify that it is a...

2005-12-05  Ed Schonberg  <schonberg@adacore.com>

	* sem_ch9.adb (Analyze_Delay_Alternative, Analyze_Delay_Until): Use the
	first subtype of the type of the expression to verify that it is a
	legal Time type.

From-SVN: r108305
parent 39edfb45
...@@ -525,6 +525,7 @@ package body Sem_Ch9 is ...@@ -525,6 +525,7 @@ package body Sem_Ch9 is
procedure Analyze_Delay_Alternative (N : Node_Id) is procedure Analyze_Delay_Alternative (N : Node_Id) is
Expr : Node_Id; Expr : Node_Id;
Typ : Entity_Id;
begin begin
Tasking_Used := True; Tasking_Used := True;
...@@ -549,9 +550,11 @@ package body Sem_Ch9 is ...@@ -549,9 +550,11 @@ package body Sem_Ch9 is
Pre_Analyze_And_Resolve (Expr); Pre_Analyze_And_Resolve (Expr);
end if; end if;
Typ := First_Subtype (Etype (Expr));
if Nkind (Delay_Statement (N)) = N_Delay_Until_Statement if Nkind (Delay_Statement (N)) = N_Delay_Until_Statement
and then not Is_RTE (Base_Type (Etype (Expr)), RO_CA_Time) and then not Is_RTE (Typ, RO_CA_Time)
and then not Is_RTE (Base_Type (Etype (Expr)), RO_RT_Time) and then not Is_RTE (Typ, RO_RT_Time)
then then
Error_Msg_N ("expect Time types for `DELAY UNTIL`", Expr); Error_Msg_N ("expect Time types for `DELAY UNTIL`", Expr);
end if; end if;
...@@ -592,16 +595,18 @@ package body Sem_Ch9 is ...@@ -592,16 +595,18 @@ package body Sem_Ch9 is
------------------------- -------------------------
procedure Analyze_Delay_Until (N : Node_Id) is procedure Analyze_Delay_Until (N : Node_Id) is
E : constant Node_Id := Expression (N); E : constant Node_Id := Expression (N);
Typ : Entity_Id;
begin begin
Tasking_Used := True; Tasking_Used := True;
Check_Restriction (No_Delay, N); Check_Restriction (No_Delay, N);
Check_Potentially_Blocking_Operation (N); Check_Potentially_Blocking_Operation (N);
Analyze (E); Analyze (E);
Typ := First_Subtype (Etype (E));
if not Is_RTE (Base_Type (Etype (E)), RO_CA_Time) and then if not Is_RTE (Typ, RO_CA_Time) and then
not Is_RTE (Base_Type (Etype (E)), RO_RT_Time) not Is_RTE (Typ, RO_RT_Time)
then then
Error_Msg_N ("expect Time types for `DELAY UNTIL`", E); Error_Msg_N ("expect Time types for `DELAY UNTIL`", E);
end if; end if;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment