This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-10-26


1274. Common nonterminal for expression and braced-init-list

Section: 8.6.5  [stmt.ranged]     Status: CD4     Submitter: Daniel Krügler     Date: 2011-03-25

[Moved to DR at the October, 2015 meeting.]

It would be helpful to have a single grammar term for expression and braced-init-list, which often occur together in the text. In particular, 8.6.5 [stmt.ranged] paragraph 1 allows both, but the description of __RangeT refers only to the expression case; such errors would be less likely if the common term were available.

Proposed resolution (May, 2015):

  1. Add a new production to the grammar in 9.4 [dcl.init] paragraph 1:

  2. Change the grammar in 7.6.1 [expr.post] paragraph 1 as follows:

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

  4. Change 8.6.5 [stmt.ranged] paragraph 1 as follows:

  5. For a range-based for statement of the form

    let range-init be equivalent to the expression surrounded by parentheses90

    and for a range-based for statement of the form

    let range-init be equivalent to the braced-init-list. In each case, a A range-based for statement is equivalent to

      {
      auto && __range = range-init for-range-initializer;
        for ( auto __begin = begin-expr,
                   __end = end-expr;
              __begin != __end;
              ++__begin ) {
          for-range-declaration = *__begin;
          statement
        }
      }
    

    where

  6. Change the grammar of 8.7 [stmt.jump] paragraph 1 as follows:

  7. Change 8.7.4 [stmt.return] paragraph 2 as follows:

  8. The expression or braced-init-list expr-or-braced-init-list of a return statement is called its operand. A return statement...
  9. Change 12.4.5 [over.sub] paragraph 1 as follows:

  10. operator[] shall be a non-static member function with exactly one parameter. It implements the subscripting syntax

    or

    Thus, a subscripting expression...