Created on2011-03-25.00:00:00 last changed109 months ago
[Moved to DR at the October, 2015 meeting.]
Proposed resolution (May, 2015):
Add a new production to the grammar in 9.5 [dcl.init] paragraph 1:
Change the grammar in 7.6.1 [expr.post] paragraph 1as follows:
Change the grammar in 8.6 [stmt.iter] paragraph 1as follows:
Change 8.6.5 [stmt.ranged] paragraph 1 as follows:
For a range-basedfor statement of the form
for (for-range-declaration:expression)statement
letrange-init be equivalent to theexpressionsurrounded by parentheses90
(expression)
and for a range-basedfor statement of the form
for (for-range-declaration:braced-init-list)statement
letrange-init be equivalent tothebraced-init-list. In each case,aA range-based for statement is equivalentto{ auto && __range =range-initfor-range-initializer; for ( auto __begin = begin-expr, __end = end-expr; __begin != __end; ++__begin ) {for-range-declaration = *__begin;statement } }where
if thefor-range-initializer is anexpression, it is regarded as if it were surroundedby parentheses (so that a comma operator cannot bereinterpreted as delimitingtwoinit-declarators);
__range,__begin,and__end are variables defined for expositiononly
,; and
_RangeT is the type of the expression,andbegin-expr andend-expr are determined asfollows:
if
_RangeTthefor-range-initializer is anexpressionof array typeR,begin-exprandend-expr are__range and__range +__bound, respectively, where__bound is thearraybound. If_RangeTRis an array of unknown size or an array of incomplete type,the program is ill-formed;if
_RangeTthefor-range-initializer isaan expression of class typeC,theunqualified-idsbegin andendare looked up in the scope ofclass_RangeTC as if by class member access lookup(_N4868_.6.5.6 [basic.lookup.classref]), and if either (or both) findsat least one declaration,begin-exprandend-expr are__range.begin() and__range.end(),respectively;otherwise,begin-expr andend-expr arebegin(__range) andend(__range),respectively, wherebegin andend arelooked up in the associated namespaces(6.5.4 [basic.lookup.argdep]). [Note: Ordinaryunqualified lookup (6.5.3 [basic.lookup.unqual]) is notperformed. —end note]
Change the grammar of 8.8 [stmt.jump] paragraph 1as follows:
Change 8.8.4 [stmt.return] paragraph 2 as follows:
Theexpressionorbraced-init-listexpr-or-braced-init-listof areturn statement is called its operand. Areturn statement...
Change 12.4.5 [over.sub] paragraph 1 as follows:
operator[] shall be a non-static member function withexactly one parameter. It implements the subscriptingsyntax
postfix-expression[
expressionexpr-or-braced-init-list]
or
postfix-expression[braced-init-list]Thus, a subscripting expression...
It would be helpful to have a single grammar term forexpression andbraced-init-list, which often occurtogether in the text. In particular, 8.6.5 [stmt.ranged] paragraph 1allows both, but the description of__RangeTrefers only to theexpression case; such errors would be lesslikely if the common term were available.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2017-02-06 00:00:00 | admin | set | status: dr -> cd4 |
| 2015-11-10 00:00:00 | admin | set | messages: +msg6070 |
| 2015-11-10 00:00:00 | admin | set | status: ready -> dr |
| 2015-05-25 00:00:00 | admin | set | messages: +msg5451 |
| 2015-05-25 00:00:00 | admin | set | status: drafting -> ready |
| 2011-03-25 00:00:00 | admin | create | |