This patch fixes an omission in the processing of pragma Predicate, which
should have the same semantics as the corresponding aspect, which is more
commonly used.
Executing
gnatmake -q -gnata predicate
predicate
must yield:
Even1 violated
Even2 violated
----
with Text_IO; use Text_IO;
procedure Predicate is
begin
begin
declare
subtype Even1 is Integer;
pragma Predicate (Even1, Even1 mod 2 = 0);
X1 : constant Even1 := 1; -- This should fail first
begin
null;
end;
exception
when Others => Put_Line ("Even1 violated");
end;
begin
declare
subtype Even2 is Integer with Predicate => Even2 mod 2 = 0;
X2 : constant Even2 := 1; -- This should fail later, if reached
begin
null;
end;
exception
when Others => Put_Line ("Even2 violated");
end;
end;
2018-01-11 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_prag.adb (Analyze_Pragma, case Predicate): Indicate that the type
has a delayed aspect which must be processed at the point the type is
frozen. This mimics what is done when the predicate is provided by a
source aspect.
From-SVN: r256495
+2018-01-11 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_prag.adb (Analyze_Pragma, case Predicate): Indicate that the type
+ has a delayed aspect which must be processed at the point the type is
+ frozen. This mimics what is done when the predicate is provided by a
+ source aspect.
+
2018-01-11 Doug Rupp <rupp@adacore.com>
* init.c (vxworks): Add macro checks for __aarch64__.
-- general Assertion_Policy pragma) to preserve existing warnings.
Set_Has_Predicates (Typ);
+
+ -- Indicate that the pragma must be processed at the point the
+ -- type is frozen, as is done for the corresponding aspect.
+
+ Set_Has_Delayed_Aspects (Typ);
+ Set_Has_Delayed_Freeze (Typ);
+
Set_Predicates_Ignored (Typ,
Present (Check_Policy_List)
and then