comp.lang.ada
 help / color / mirror / Atom feed
* GNAT Problem on recursive generics?
@ 1996-11-29  0:00 Debora Weber-Wulff
  1996-12-01  0:00 ` Robert Dewar
  1996-12-02  0:00 ` Ray Blaak
  0 siblings, 2 replies; 5+ messages in thread
From: Debora Weber-Wulff @ 1996-11-29  0:00 UTC (permalink / raw)



Ran into this problem in GNAT 3.05 using the IDE on a PC the other
day:


-- foo.ads
generic
   type element is (<>);
procedure foo (e: in out element);

-- foo.adb
procedure foo (e: in out element) is
   begin
   if 1=1 then
     foo(element'pred(e));
   else
     foo(element'succ(e));
end if;
end foo;

-- foo.lsb

GNAT 3.05 (960607) Copyright 1991-1996 Free Software Foundation, Inc.

Compiling: foo.adb (source file time stamp: 1996-11-27 16:17:58)

     1. procedure foo (e: in out element) is
     2.    begin
     3.    if 1=1 then
     4.      foo(element'pred(e));
	     |
	>>> "foo" is not visible (more references follow)
	>>> non-visible declaration at foo.ads:3

     5. else
     6.     foo(element'succ(e));
     7. end if;
     8. end foo;

 8 lines:

According to the LRM for Ada 95, a recursive call is permitted in a
generic unit (I think, I'm not a practicing language lawyer). 

We found a work-around by putting foo in a generic *package* bar
that has the same generic parameters as foo needed. Works like a charm :-)

Is this something I don't understand or a GNAT problem? 
[I know that this belongs in some gnat-errors mailing list, but I?ve
looked and can't find the address. Happens often recently. I know there
is a group for this or that, but can't remember where I wrote down
the reference...]

--
Debora Weber-Wulff (Professorin fuer Softwaretechnik und Programmiersprachen)
Technische Fachhochschule Berlin, FB Informatik, Luxemburger Str. 10, 
13353 Berlin, Germany        email: weberwu@tfh-berlin.de   
<http://www.tfh-berlin.de/~weberwu/> 




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

end of thread, other threads:[~1996-12-03  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-29  0:00 GNAT Problem on recursive generics? Debora Weber-Wulff
1996-12-01  0:00 ` Robert Dewar
1996-12-02  0:00 ` Ray Blaak
1996-12-03  0:00   ` Debora Weber-Wulff
1996-12-03  0:00     ` Robert Dewar

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