Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #8069 > unrolled thread
| Started by | Victor Porton <porton@narod.ru> |
|---|---|
| First post | 2017-09-29 19:40 +0300 |
| Last post | 2017-09-29 19:41 +0300 |
| Articles | 2 — 1 participant |
Back to article view | Back to comp.programming
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
| From | Victor Porton <porton@narod.ru> |
|---|---|
| Date | 2017-09-29 19:40 +0300 |
| Subject | Is Adjust allowed on assignment of to a class-wide argument? |
| Message-ID | <oqlt18$1iuh$1@gioia.aioe.org> |
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
[toc] | [next] | [standalone]
| From | Victor Porton <porton@narod.ru> |
|---|---|
| Date | 2017-09-29 19:41 +0300 |
| Message-ID | <oqlt4k$1j23$1@gioia.aioe.org> |
| In reply to | #8069 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.programming
csiph-web