Version 1.3 of acs/ac-00001.txt

Unformatted version of acs/ac-00001.txt version 1.3
Other versions for file acs/ac-00001.txt

!standard 08.06 (01)          00-09-25 AC95-00001/01
!class confirmation 00-09-25
!status received no action 00-09-25
!subject Resolution of the prefix of 'Address
!summary
Normal overload resolution rules apply to the prefix of the Address attribute. This is clear in the standard, no AI is needed.
!appendix

From: srolsen@COLLINS.ROCKWELL.COM
Sent: Friday, September 22, 2000 8:17 PM

Description:

In procedure P, Q'Address could presumably refer to procedure Try_Ap.Q,
package Try_Ap_P1.Q, or the two Try_Ap_P2.Q procedures.

Here is the sample code:

   package Try_Ap_P1 is
   end Try_Ap_P1;

   package Try_Ap_P1.Q is
     procedure Q;
   end Try_Ap_P1.Q;

   package Try_Ap_P2 is
     procedure Q (A : Integer);
     procedure Q (A : Float);
   end Try_Ap_P2;

   with System;
   with Try_Ap_P1.Q;
   with Try_Ap_P2;

   package body Try_Ap is

     use Try_Ap_P1;
     use Try_Ap_P2;

     procedure Q is
     begin
       null;
     end Q;

     procedure P is
       A : System.Address;
     begin
       A := Q'Address;
     end P;

   end Try_Ap;

Desired response:

Which address will be assigned to A, the address of Try_Ap.Q, Try_Ap_P1.Q,
or one of the Q procedures in Try_Ap_P2?

What is the "rule" for selecting the procedure?

Is it correct to issue an error message or warning when this code is
compiled?  Please explain your answer.  Thank you.

****************************************************************

From: Tucker Taft
Sent: Friday, September 22, 2000 10:12 PM

> Which address will be assigned to A, the address of Try_Ap.Q, Try_Ap_P1.Q,
> or one of the Q procedures in Try_Ap_P2?

Try_Ap.Q.

> What is the "rule" for selecting the procedure?

The other Q's are not use-visible, because one is non-overloadable
and one is overloadable, so they "cancel out" as specified in 8.4(11).

> Is it correct to issue an error message or warning when this code is
> compiled?

It is not correct to issue an error message.  There are no rules about
issuing warnings -- compilers can pretty much do whatever they
want when it comes to warnings.

> Please explain your answer.  Thank you.

There is only one Q visible, so there is no ambiguity.  This is
because the multiple potentially use-visible Q's are not all overloadable,
so none of them are actually use-visible.

****************************************************************

From: Robert Dewar
Sent: Friday, September 22, 2000 10:09 PM

I agree with Tuck, this is a clear case.

****************************************************************

From: Robert A Duff
Sent: Saturday, September 23, 2000 2:28 PM

> There is only one Q visible, so there is no ambiguity.  This is
> because the multiple potentially use-visible Q's are not all overloadable,
> so none of them are actually use-visible.

Right, but one might wonder what Q'Address does when Q *is* overloaded
(eg if the package were removed from the example).
The answer is that the normal overload resolution rules apply: it's
ambiguous.  See 8.6.

****************************************************************

From: Erhard Ploedereder
Sent: Monday, September 25, 2000 3:10 AM

I agree. (And this is not worth an AI, since it is clear from the RM.)

****************************************************************

Questions? Ask the ACAA Technical Agent