Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #8069

Is Adjust allowed on assignment of to a class-wide argument?

From Victor Porton <porton@narod.ru>
Newsgroups comp.programming
Subject Is Adjust allowed on assignment of to a class-wide argument?
Date 2017-09-29 19:40 +0300
Organization Aioe.org NNTP Server
Message-ID <oqlt18$1iuh$1@gioia.aioe.org> (permalink)

Show all headers | View raw


Is the following program allowed to print "Adjust"?

GCC 7.2.0 does not print "Adjust". I suspect it is because GCC optimizes 
away an allowed Adjust procedure.

Is it allowed to call Adjust? Will a compiler be conforming to the spec if 
it produces from the below source a program which prints "Adjust"?

---------------
with Ada.Finalization;
with Ada.Text_IO;

procedure Test is

  type A is new Ada.Finalization.Controlled with null record;

  type B is new A with null record;

  overriding procedure Adjust (Object: in out B) is
  begin
    Ada.Text_IO.Put_Line("Adjust");
  end;

  procedure X (Arg: A'Class) is
  begin
    null;
  end;

  Object: B;

begin
  X(Object);
end;

-- 
Victor Porton - http://portonvictor.org

Back to comp.programming | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Is Adjust allowed on assignment of to a class-wide argument? Victor Porton <porton@narod.ru> - 2017-09-29 19:40 +0300
  Re: Is Adjust allowed on assignment of to a class-wide argument? Victor Porton <porton@narod.ru> - 2017-09-29 19:41 +0300

csiph-web