Left_Opnd => L,
Right_Opnd => R);
- -- We reset the Entity since we do not want to bypass the operator
- -- resolution.
+ if Is_Record_Or_Limited_Type (Etype (Alt)) then
- Set_Entity (Cond, Empty);
+ -- We reset the Entity in order to use the primitive equality
+ -- of the type, as per RM 4.5.2 (28.1/4).
+
+ Set_Entity (Cond, Empty);
+ end if;
end if;
return Cond;
N_Protected_Definition);
end Is_Protected_Operation;
+ -------------------------------
+ -- Is_Record_Or_Limited_Type --
+ -------------------------------
+
+ function Is_Record_Or_Limited_Type (Typ : Entity_Id) return Boolean is
+ begin
+ return Is_Record_Type (Typ) or else Is_Limited_Type (Typ);
+ end Is_Record_Or_Limited_Type;
+
----------------------
-- Nearest_Ancestor --
----------------------
-- Given a subprogram or entry, determines whether E is a protected entry
-- or subprogram.
+ function Is_Record_Or_Limited_Type (Typ : Entity_Id) return Boolean;
+ -- Return True if Typ requires is a record or limited type.
+
function Nearest_Ancestor (Typ : Entity_Id) return Entity_Id;
-- Given a subtype Typ, this function finds out the nearest ancestor from
-- which constraints and predicates are inherited. There is no simple link
Op := Make_Op_Ne (Loc, Left_Opnd => L, Right_Opnd => R);
end if;
- -- We reset the Entity since we do not want to bypass the operator
- -- resolution.
+ if Is_Record_Or_Limited_Type (Etype (L)) then
+
+ -- We reset the Entity in order to use the primitive equality
+ -- of the type, as per RM 4.5.2 (28.1/4).
+
+ Set_Entity (Op, Empty);
+ end if;
- Set_Entity (Op, Empty);
Rewrite (N, Op);
Analyze (N);
return;