return;
end if;
+ -- Ignore if types involved have predicates
+
+ if Present (Predicate_Function (Etype (Left)))
+ or else
+ Present (Predicate_Function (Etype (Right)))
+ then
+ return;
+ end if;
+
-- Case of right operand is a subtype name
if Is_Entity_Name (Right) then
T2 : Entity_Id) return Boolean
is
begin
+ -- Scalar types
+
if Is_Scalar_Type (T1) then
-- Definitely compatible if we match
then
return True;
- -- Base types must match, but we don't check that (should
- -- we???) but we do at least check that both types are
- -- real, or both types are not real.
+ -- Base types must match, but we don't check that (should we???) but
+ -- we do at least check that both types are real, or both types are
+ -- not real.
elsif Is_Real_Type (T1) /= Is_Real_Type (T2) then
return False;
end;
end if;
+ -- Access types
+
elsif Is_Access_Type (T1) then
- return not Is_Constrained (T2)
- or else Subtypes_Statically_Match
- (Designated_Type (T1), Designated_Type (T2));
+ return (not Is_Constrained (T2)
+ or else (Subtypes_Statically_Match
+ (Designated_Type (T1), Designated_Type (T2))))
+ and then not (Can_Never_Be_Null (T2)
+ and then not Can_Never_Be_Null (T1));
+
+ -- All other cases
else
return (Is_Composite_Type (T1) and then not Is_Constrained (T2))
when N_Type_Conversion =>
Why_Not_Static (Expression (N));
- if not Is_Scalar_Type (Etype (Prefix (N)))
- or else not Is_Static_Subtype (Etype (Prefix (N)))
+ if not Is_Scalar_Type (Entity (Subtype_Mark (N)))
+ or else not Is_Static_Subtype (Entity (Subtype_Mark (N)))
then
Error_Msg_N
("static conversion requires static scalar subtype result " &