https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79566
Bug ID: 79566 Summary: [6/7 Regression] elaborated-type-specifier incorrectly rejected in range-based for Product: gcc Version: 6.3.1 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- struct X { struct Y { }; Y* begin(); Y* end(); }; void f() { X x; for (struct X::Y& y : x) ; } This is valid, but GCC 6 and 7 say: for.cc:11:8: error: types may not be defined in a for-range-declaration [-fpermissive] for (struct X::Y& y : x) ^~~~~~