From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7039 invoked by alias); 9 Mar 2011 09:19:06 -0000 Received: (qmail 7028 invoked by uid 22791); 9 Mar 2011 09:19:05 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Mar 2011 09:19:00 +0000 From: "demoonlit at panathenaia dot halfmoon.jp" To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/48039] New: Legal program rejected, a formal function is not visible in generic X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ada X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: demoonlit at panathenaia dot halfmoon.jp X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Wed, 09 Mar 2011 09:19:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg00812.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48039 Summary: Legal program rejected, a formal function is not visible in generic Product: gcc Version: 4.5.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassigned@gcc.gnu.org ReportedBy: demoonlit@panathenaia.halfmoon.jp Created attachment 23589 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23589 minimal bug triggering source code Name lookup is abnormal in complex generic code with gcc-4.5.1/4.5.2. -- p.ads package p is end p; -- p-gh.ads generic function p.gh return Integer; -- p-gh.adb function p.gh return Integer is begin return 0; end p.gh; -- p-gu.ads generic package p.gu is generic with function h return Integer is <>; -- with function fh return Integer is <>; -- ok function gh return Integer; end p.gu; -- p-gu.adb package body p.gu is function gh return Integer is begin return h; -- error !! -- return fh; -- ok end gh; end p.gu; -- p-h.ads with p.gh; function p.h is new gh; -- p-u.ads with p.gu; package p.u is new gu; -- p-r.ads with p.u; package p.r is end p.r; -- p-r-h.ads with p.h; function p.r.h is new u.gh (h); % gnatmake p-r-h.ads gcc -c p-r-h.ads p-r-h.ads:4:01: instantiation error at p-gu.adb:6 p-r-h.ads:4:01: "h" is not visible p-r-h.ads:4:01: instantiation error at p-gu.adb:6 p-r-h.ads:4:01: non-visible declaration at line 4 p-r-h.ads:4:01: instantiation error at p-gu.adb:6 p-r-h.ads:4:01: non-visible declaration at p-h.ads:4 gnatmake: "p-r-h.ads" compilation error This code will be compiled If we rename formal function h to another name (for example, fh).