Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iterator specification refused witihout subtype qualification #177

Open
evanescente-ondine opened this issue Jul 4, 2024 · 0 comments
Open

Comments

@evanescente-ondine
Copy link

Hi,
The iterator specification in the loop statement of the following sample down there

for LINE : String of [for I in Letters'range => S(I) & M(I)] loop

is refused, with error: name expected. But it seems to me there should be enough information to infer the subtype unambiguously. And the "String" is superfluous too, as the expression's type should be obvious too.
Is it a version issue (GNAT 13.3.0) or did I misunderstand the standard ?

Thanks.

pragma Ada_2022;
pragma Extensions_Allowed (On);
with Ada.Text_IO; use Ada.Text_IO;

procedure DISPLAY_INITIALS is
   type Letters is array (1..8) of String;
   M : constant Letters :=
     ["*             *",
      "**           **",
      "* *         * *",
      "*  *       *  *",
      "*   *     *   *",
      "*    *   *    *",
      "*     * *     *",
      "*      *      *"];
   S : constant Letters :=
     ["***************",
      "*             *",
      "*             *",
      "*             *",
      "***************",
      "              *",
      "              *",
      "***************"];
begin
      for LINE : String of [for I in Letters'range => S(I) & M(I)] loop
         PUT_LINE(LINE);
      end loop;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant