comp.lang.ada
 help / color / mirror / Atom feed
* Accessibility and possible Gnat bug
@ 2014-12-19 15:35 Michael B.
  2014-12-19 17:34 ` Tero Koskinen
  0 siblings, 1 reply; 3+ messages in thread
From: Michael B. @ 2014-12-19 15:35 UTC (permalink / raw)


In the previous discussion about accessibility I was pointed to the 
paper "Accessibility rules OK!" of John Barnes (ACM SIGAda Ada Letters 
Volume XV Issue 1, Jan./Feb. 1995) which contains the following example:

procedure Example6  is
    type T is new Integer;

    procedure P1(XP1 : access T) is
       type A is access all T;
       Ptr: A := null;

       procedure P2(XP2: access T) is
       begin
          Ptr := A(XP2);
       end P2;

    begin
       P2(XP1);
    end P1;

    X : aliased T;

begin
    declare
       Y : aliased T;
     begin
       declare
          Z : aliased T;
        begin
          P1(X'Access);
          P1(Y'Access);
          P1(Z'Access);   -- Raises Program_Error.
        end;
     end;
end Example6;

In the paper the program is expected to run without errors.
I compiled it with Gnat 4.9 on Debian 8.0, ran it and got an 
Program_Error on the marked line.

Is this correct in Ada 2012 or not? I would like to hear your opinion 
about that before I write a possibly unnecessary bug report to AdaCore.

Regards,

Michael


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-20 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-19 15:35 Accessibility and possible Gnat bug Michael B.
2014-12-19 17:34 ` Tero Koskinen
2014-12-20 14:17   ` Michael B.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox