Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #8070
| From | Victor Porton <porton@narod.ru> |
|---|---|
| Newsgroups | comp.programming |
| Subject | Re: Is Adjust allowed on assignment of to a class-wide argument? |
| Date | 2017-09-29 19:41 +0300 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <oqlt4k$1j23$1@gioia.aioe.org> (permalink) |
| References | <oqlt18$1iuh$1@gioia.aioe.org> |
Victor Porton wrote:
> 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;
>
Sorry, wrong Usenet group.
--
Victor Porton - http://portonvictor.org
Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll 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