comp.lang.ada
 help / color / mirror / Atom feed
* Renaming of procedures in a generic instantiation
@ 2010-09-26  0:43 Gene
  2010-09-26  6:54 ` Niklas Holsti
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Gene @ 2010-09-26  0:43 UTC (permalink / raw)


I'm confused about an aspect of renaming. It boils out to this little
example:

with Ada.Containers.Ordered_Sets;

package Foo is

  type Queue is private;

  procedure Add(Q : in out Queue; Item : in Integer);

  function Is_Empty(Q : Queue) return Boolean;

private

  package Queues is
    new Ada.Containers.Ordered_Sets(Integer, "<", "=");
  type Queue is new Queues.Set with null record;

end Foo;

package body Foo is

   procedure Add(Q : in out Queue; Item : in Integer)
      renames Insert;

   function Is_Empty(Q : Queue) return Boolean
      renames Queues.Is_Empty;

end Foo;

The renaming in Add "finds" the correct procedure Insert, but the
renaming of Is_Empty fails:

gnatmake foo.adb
gcc -c foo.adb
foo.adb:6:04: no visible subprogram matches the specification for
"Is_Empty"
foo.adb:6:13: expected private type "Ada.Containers.Ordered_Sets.Set"
from insta
nce at foo.ads:14
foo.adb:6:13: found type "Queue" defined at foo.ads:16
gnatmake: "foo.adb" compilation error

I guess I can see this error because a parameter type conversion is
implied in the renaming.  But then why does the renaming of Insert
work correctly?

Running Win7 64 bit with:
gcc (GCC) 4.3.4 20090511 for GNAT GPL 2009 (20090511)

Thanks.



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

end of thread, other threads:[~2010-09-29  1:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-26  0:43 Renaming of procedures in a generic instantiation Gene
2010-09-26  6:54 ` Niklas Holsti
2010-09-26  7:40   ` Jeffrey Carter
2010-09-26  8:41     ` Niklas Holsti
2010-09-26 17:07       ` Jeffrey Carter
2010-09-26 14:52   ` Gene
2010-09-26 15:04     ` Dmitry A. Kazakov
2010-09-26  8:45 ` Stephen Leake
2010-09-26  9:11   ` Niklas Holsti
2010-09-27  1:18   ` Gene
2010-09-28 11:36     ` Stephen Leake
2010-09-29  1:25       ` Gene
2010-09-27 19:23 ` Adam Beneschan

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