* Text_IO.Text_Streams causing errors
@ 2011-02-25 15:14 Julian Leyh
2011-02-25 17:34 ` Adam Beneschan
0 siblings, 1 reply; 2+ messages in thread
From: Julian Leyh @ 2011-02-25 15:14 UTC (permalink / raw)
Hi, i have some code that looks like this (stripped to minimal
example):
-- bar.adb:
with Foo;
procedure Bar is
Foobar : aliased Foo.Foobar;
begin
Foo.Print (Foobar'Access, "Foobar");
end Bar;
-- foo.adb:
with Text_IO.Text_Streams;
package body Foo is
procedure Print (This : access Foobar'Class; Prefix : in String) is
begin
Text_IO.Put_Line (Prefix);
end Print;
end Foo;
-- foo.ads:
package Foo is
type Foobar is tagged private;
procedure Print (This : access Foobar'Class; Prefix : in String);
private
type Foobar is tagged null record;
end Foo;
Compiling it, I get this error:
foo.adb:3:14: not fully conformant with declaration at foo.ads:3
foo.adb:3:14: type of "This" does not match
If I add -gnat05, the error disappears, and it disappears, too, if I
add the "Ada." prefix to the "with".
I know that I could remove the "Text_Streams", because it is not used
at all, but I'm still a big confused about this error.
Is it a compiler bug or did I do something forbidden?
Tried with compilers GNAT GPL 2010 and GNAT Pro 6.3.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Text_IO.Text_Streams causing errors
2011-02-25 15:14 Text_IO.Text_Streams causing errors Julian Leyh
@ 2011-02-25 17:34 ` Adam Beneschan
0 siblings, 0 replies; 2+ messages in thread
From: Adam Beneschan @ 2011-02-25 17:34 UTC (permalink / raw)
On Feb 25, 7:14 am, Julian Leyh <jul...@vgai.de> wrote:
> Hi, i have some code that looks like this (stripped to minimal
> example):
>
> -- bar.adb:
> with Foo;
> procedure Bar is
> Foobar : aliased Foo.Foobar;
> begin
> Foo.Print (Foobar'Access, "Foobar");
> end Bar;
>
> -- foo.adb:
> with Text_IO.Text_Streams;
> package body Foo is
> procedure Print (This : access Foobar'Class; Prefix : in String) is
> begin
> Text_IO.Put_Line (Prefix);
> end Print;
> end Foo;
>
> -- foo.ads:
> package Foo is
> type Foobar is tagged private;
> procedure Print (This : access Foobar'Class; Prefix : in String);
> private
> type Foobar is tagged null record;
> end Foo;
>
> Compiling it, I get this error:
>
> foo.adb:3:14: not fully conformant with declaration at foo.ads:3
> foo.adb:3:14: type of "This" does not match
>
> If I add -gnat05, the error disappears, and it disappears, too, if I
> add the "Ada." prefix to the "with".
and, I assume, changing the procedure call to
Ada.Text_IO.Put_Line(...)
> I know that I could remove the "Text_Streams", because it is not used
> at all, but I'm still a big confused about this error.
>
> Is it a compiler bug or did I do something forbidden?
Compiler bug. There's certainly no way that adding Ada. to Text_IO
could possibly affect the legality of the "This" parameter.
-- Adam
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-02-25 17:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-25 15:14 Text_IO.Text_Streams causing errors Julian Leyh
2011-02-25 17:34 ` Adam Beneschan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox