From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, WEIRD_PORT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4d448bf6bac07244,start X-Google-Attributes: gid103376,public From: weberwu@compute.tfh-berlin.de (Debora Weber-Wulff) Subject: GNAT Problem on recursive generics? Date: 1996/11/29 Message-ID: <57moem$phr@sun04.tfh-berlin.de>#1/1 X-Deja-AN: 201696230 organization: TFH-Berlin (Berlin, Germany) newsgroups: comp.lang.ada Date: 1996-11-29T00:00:00+00:00 List-Id: 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