Defect report #4nn

Previous Defect Report < - > Next Defect Report

Submitter: Jens Gustedt
Submission Date:
2012-10-08 Source:
Reference Document: N/A
Version: 1.0
Date: 2012-10-08
Subject: sytax error in specification of for-statement


The standard lists two different forms for the for-statement in 6.8.5p1:

for ( expression[opt] ; expression[opt] ; expression[opt] ) statement
for ( declaration expression[opt] ; expression[opt] ) statement

whereas later in these two forms are subsumed in a third form by:

for ( clause-1 ; expression-2 ; expression-3 ) statement

Obviously the second form above is a typo and doesn't fit within this third form, the semantic that is given in and to common practice in existing compilers.

Suggested Technical Corrigendum

Replace the second form in 6.8.5p1 and A.2.3 by the intended one:

for ( declaration expression[opt] ; expression[opt] ; expression[opt] ) statement

Previous Defect Report < - > Next Defect Report