Version 1.1 of acs/ac-00019.txt

Unformatted version of acs/ac-00019.txt version 1.1
Other versions for file acs/ac-00019.txt

!standard 7.3(01)          01-11-20 AC95-00019/01
!class confirmation 01-11-20
!status received no action 01-11-20
!subject Private part unseen by package body
!summary
!appendix

From: Craig Carey
Sent: Wednesday, November 20, 2001  3:23 PM

The  Type'Access  was not of any use when I tried it. An
"invisible selector" problem occurred, at least in GNAT 3.13p. I had
reported it as a bug in about March 2001.

It seems that the 'Access is not so useful due to a problem not much
related to it. The code in the package body can't see the declarations
in the private part of the package.

------------------------------------------------------------------------

package InvisibleAccess is
    type Cable_rec;
    type Cable_recptr is access all Cable_rec;

    type Cable_Task_1 (C : Boolean) is limited private;
    type Cable_Task_2 (Cable : access Cable_rec) is limited private;

    type Cable_rec is
       limited record
          Quiet             : Integer;
          Tsk_1             : Cable_Task_1 (C => True);
          Tsk_2             : Cable_Task_2 (Cable => Cable_rec'Access);
       end record;

    procedure Cable_Set_Parameters;

private
    task type Cable_Task_1 (C : Boolean) is
       entry Parameters (P_1 : Natural);
    end Cable_Task_1;

    task type Cable_Task_2 (Cable : access Cable_rec) is
       entry Parameters (P_2 : Natural);
    end Cable_Task_2;

end InvisibleAccess;


package body InvisibleAccess is

    task body Cable_Task_1 is
    begin
       select
          accept Parameters (P_1 : Natural) do
             null;
          end Parameters;
       or
          terminate;
       end select;
    end Cable_Task_1;

    task body Cable_Task_2 is
    begin
       select
          accept Parameters (P_2 : Natural) do
             null;
          end Parameters;
       or
          terminate;
       end select;
    end Cable_Task_2;

    procedure Cable_Set_Parameters is
       H           : Cable_rec;
    begin
       H.Tsk_1.Parameters (P_1 => 1);
       H.Tsk_2.Parameters (P_2 => 2);
    end Cable_Set_Parameters;

end InvisibleAccess;


------------------------------------------------------------------------

When compiled this error results.
GNAT 3.13p for Windows NT.

25.    procedure Cable_Set_Parameters is
26.       H           : Cable_rec;
27.    begin
28.       H.Tsk_1.Parameters (P_1 => 1);
                  |
     >>> error: invisible selector for type "Cable_Task_1" defined at
                                                  invisibleaccess.ads:21

29.       H.Tsk_2.Parameters (P_2 => 2);
                  |
     >>> error: invisible selector for type "Cable_Task_2" defined at
                                                  invisibleaccess.ads:25

30.    end Cable_Set_Parameters;
31.
32. end InvisibleAccess;
------------------------------------------------------------------------

A way to remove the syntax errors (GNAT 3.13p), is to shift the private
code into the public part.

Can someone explain the error?. I did report it to report@gnat.com in
February 2001 and no comment came back. If it is a GNAT bug then it
won't be about Ada.

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

From: Tucker Taft
Sent: Wednesday, November 20, 2001  7:32 PM

This appears to be a GNAT bug.  Your Ada source
code compiles cleanly with our "AdaMagic" front end.

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

From: Robert Dewar
Sent: Wednesday, November 20, 2001  7:57 PM

It also compiles fine with GNAT Professional, I see no reason why one would
doubt the legality of this program, it is clearly legal.

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


Questions? Ask the ACAA Technical Agent