"Corresponding" predefined operation of a derived type AI00567/01 1
880902 BI RE
 !standard 03.04 (06) 880902 AI00567/01
!class binding interpretation 880706
!status received 880706
!topic "Corresponding" predefined operation of a derived type
!summary 880706
!question 880706
!recommendation 880706
!discussion 880706
 !appendix 880711
*****************************************************************************
!section 03.04 (06) Norman Cohen 880504 8300968
!version 1983
!topic "Corresponding" predefined operation of a derived type
Certain predefined operators have an operand that is always of type
INTEGER. These are fixedpointINTEGER multiplication and division
(4.5.5(7)) and exponentiation (4.5.6(5)).
3.4(6) states, "For each enumeration literal or predefined operator of
the parent type there is a corresponding operation for the derived type."
Please confirm (or bindingly interpret) the following:
1. For the predefined operators described above, the "corresponding
operation" of the derived type has a corresponding operand that is
necessarily of type INTEGER. Thus, given the declaration
type NI is new INTEGER;
the operator corresponding to the parenttype operator
function "**" (LEFT, RIGHT: INTEGER) return INTEGER;
is
function "**" (LEFT: NI; RIGHT: INTEGER) return NI;
and not
function "**" (LEFT, RIGHT: NI) return NI;
(3.4(13), which states, "The specification of a derived subprogram is
obtained implicitly by systematic replacement of the parent type by
the derived type in the specification of the derivable subprogram,"
does not apply here because, by 3.4(11), derivable subprograms must be
either explicitly declared or derived from a derivable subprogram.)
"Corresponding" predefined operation of a derived type AI00567/01 2
880902 BI RE
2. Except for the special case
function "**" (LEFT, RIGHT: INTEGER) return INTEGER;
(in which LEFT happens to be of type INTEGER), the predefined
operators described above are not to be considered "predefined
operators of the parent type" in the sense of 3.4(6) when the parent
type is INTEGER. Thus, if there is a predefined operator
function "**"
(LEFT: LONG_INTEGER; RIGHT: INTEGER) return LONG_INTEGER;
the declaration
type NI is new INTEGER;
does not cause the following operation to be derived:
function "**"
(LEFT: LONG_INTEGER; RIGHT: NI) return LONG_INTEGER;
(3.3.3(1) states, "The set of operations of a type includes the
explicitly declared subprograms that have a parameter or result of the
type...," but 3.3.3(2), which states that predefined operators are
also operations, does not explain when a predefined operation is "an
operation of" a given type.)
 *****************************************************************************

 !section 03.04 (06) Norman Cohen 880711 8300987
 !version 1983
 !topic Addendum to comment 8300968 (AI00567)

 By analogy to point (2) of the comment, the "special" multiplying
 operators described in 4.5.5(9), taking two fixedpoint operands and
 returning a universal_fixed result, are not to be considered "predefined
 operators of the parent type" in the sense of 3.4(6) when the parent type
 is a fixedpoint type. Thus, if there is a predefined operator

 function "*"
 (LEFT: FPT1; RIGHT: FPT2) return universal_fixed;

 (where FPT1 and FPT2 are fixedpoint types), the declaration

 type NFPT1 is new FPT1;

 does not cause the following operation to be derived:

 function "*"
 (LEFT: NFPT1; RIGHT: FPT2) return universal_fixed;

 Such a multiplication operation does indeed exist, but it is declared
"Corresponding" predefined operation of a derived type AI00567/01 3
880902 BI RE
 presciently in STANDARD (see paragraph 11 of Annex C) rather than
 derived.