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

            Bug ID: 63985
           Summary: Accepts invalid range-based for declaration
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: R.HL at gmx dot net

int arr[] {1, 2, 3};
    for (int i = 5: arr)
        std::cout << i << ", ";

Compiles, while it shouldn't. A warning message suggests that GCC ignores the
loop completely.

    warning: variable 'arr' set but not used

Perhaps GCC can't decide what kind of loop this is and decides to ignore it
silently?

Reply via email to