This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112e. See for the official list.


1204. Specifiers in a for-range-declaration

Section: 8.6  [stmt.iter]     Status: C++11     Submitter: Jason Merrill     Date: 2010-10-01

[Voted into the WP at the March, 2011 meeting as part of paper N3262.]

It seems unfortunate that the beginning of a C-style for loop can look like

whereas the beginning of a range-based for loop looks like

So that we don't know what constraints we are trying to apply to the specifiers until we see, or don't see, a :. The inconsistency between decl-specifier-seq and type-specifier-seq seems gratuitous and inconvenient.

Proposed resolution (November, 2010) [SUPERSEDED]:

  1. Change the grammar 8.6 [stmt.iter] paragraph 1 as follows:

  2. Add the following as a new paragraph at the end of 8.6.5 [stmt.ranged]:

  3. The the decl-specifier-seq of a for-range-declaration, each decl-specifier shall be either a type-specifier or constexpr.