https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100999

            Bug ID: 100999
           Summary: d: foreach over a tuple doesn't work on 16-bit targets
           Product: gcc
           Version: 10.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

There is an error if the index type isn't an int or long type.  This triggers
on 16-bit targets where the index would be size_t for looping over an array.
---
alias AliasSeq(TList...) = TList;
alias size_t = ushort;

void foo(int a, int b, int c)
{
    // OK
    foreach (size_t i, e; [0, 1, 2, 3]) { }

    // Errors
    static foreach (size_t i, e; [0, 1, 2, 3]) { }
    foreach (size_t i, e; AliasSeq!(0, 1, 2, 3)) { }
    static foreach (size_t i, e; AliasSeq!(0, 1, 2, 3)) { }
}

Reply via email to