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.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: 'for cursor in container.first loop' bug? References: <85y4u8xztj.fsf@stephe-leake.org> Date: Fri, 29 Aug 2014 08:52:12 -0500 Message-ID: <85lhq7xv1v.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (windows-nt) Cancel-Lock: sha1:3mkSSF0VEiBK+xK0lVV3uu6Y5dg= MIME-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 8360354008593e3fb833017489 X-Received-Bytes: 1880 X-Received-Body-CRC: 836606648 Xref: news.eternal-september.org comp.lang.ada:21982 Date: 2014-08-29T08:52:12-05:00 List-Id: "Randy Brukardt" writes: > "Stephen Leake" wrote in message > news:85y4u8xztj.fsf@stephe-leake.org... >> >> Loop_2 : >> for Cursor in First (A) loop >> Put_Line ("A (I) => " & Integer'Image (Element (Cursor))); >> Replace_Element (A, Cursor, 2); >> Reference (A, Cursor) := 2; >> end loop Loop_2; >> >> gnatmake -k ../try_containers.adb >> gcc -c -I../ -I- ../try_containers.adb >> try_containers.adb:17:28: invalid prefix in call >> try_containers.adb:17:28: invalid prefix in selected component "I572b" >> >> Am I missing something simple, or is this a compiler bug? At the very >> least, it's not a good error message. > > You're missing something simple: "First" is not an iterator (it returns a > cursor). You need to use one of the functions named "Iterate" that return a > value that has an iterator type: > > Loop_2 : > for Cursor in Iterate (A) loop Ah, thanks. That fixed it. > I'd still call it a bug, though, because the error message is inpenatrable > for something simple (a violation of 5.5.2(3/3)). Indeed, this shouldn't > even resolve. I'll report it. -- -- Stephe