-- Does all the real work of Analyze_Subprogram_Body. This is split out so
-- that we can use RETURN but not skip the debug output at the end.
- function Can_Override_Operator (Subp : Entity_Id) return Boolean;
- -- Returns true if Subp can override a predefined operator.
-
procedure Check_Conformance
(New_Id : Entity_Id;
Old_Id : Entity_Id;
-- predefined signature, because we know already that there is no
-- explicit overridden operation.
- elsif Nkind (Subp) = N_Defining_Operator_Symbol then
+ elsif Chars (Subp) in Any_Operator_Name then
if Must_Not_Override (Spec) then
-- If this is not a primitive or a protected subprogram, then
Typ : Entity_Id;
begin
- if Nkind (Subp) /= N_Defining_Operator_Symbol then
+ -- Return False if not an operator. We test the name rather than testing
+ -- that the Nkind is N_Defining_Operator_Symbol, because there are cases
+ -- where an operator entity can be an N_Defining_Identifier (such as for
+ -- function instantiations).
+
+ if Chars (Subp) not in Any_Operator_Name then
return False;
else
-- and body declarations. Returns the defining entity for the
-- specification N.
+ function Can_Override_Operator (Subp : Entity_Id) return Boolean;
+ -- Returns true if Subp can override a predefined operator
+
procedure Check_Conventions (Typ : Entity_Id);
-- Ada 2005 (AI-430): Check that the conventions of all inherited and
-- overridden dispatching operations of type Typ are consistent with their
Style.Missing_Overriding (N, Rename_Spec);
end if;
- elsif Must_Override (Specification (N)) then
+ elsif Must_Override (Specification (N))
+ and then not Can_Override_Operator (Rename_Spec)
+ then
Error_Msg_NE ("subprogram& is not overriding", N, Rename_Spec);
end if;