Defect Report #277

Previous Defect Report < - > Next Defect Report


Submitter: UK C Panel
Submission Date: 2001-09-07
Source: Clive D.W. Feather <clive@demon.net>
Version: 1.1
Date: 2002-03-07
Subject: declarations within iteration statements

Problem

Consider the code:

   for (enum fred { jim, sheila = 10 } i = jim; i < sheila; i++)
        // loop body

6.8.5#3 reads:

[#3] The declaration part of a for statement shall only declare identifiers for objects having storage class auto or register.

Does this wording forbid the declaration of tag fred - since it is not an object - or is fred not covered by that wording because it is not an object ?

Suggested Technical Corrigendum

Change 6.8.5#3 to one of:

[#3] The declaration part of a for statement shall only declare identifiers for objects; any object so declared shall have storage class auto or register.

or:

[#3] Any object whose identifier is declarared in the declaration part of a for statement shall have storage class auto or register.

Proposed Committee Response

The intent is clear enough; fred, jim, and sheila are all identifiers which do not denote objects with auto or register storage classes, and are not allowed in this context.


Previous Defect Report < - > Next Defect Report