Defect Report #115

Submission Date: 03 Dec 93
Submittor: WG14
Source: Ron Guilmette
Question
ANSI/ISO C Defect Report #rfg22:
Subject: Member declarators as declarators.
a) Does the following code involve usage which requires a diagnostic from a conforming implementation?
b) Does the following code involve usage which renders the code itself not strictly conforming?
struct { int mbr; }; /* ? */
union { int mbr; }; /*
? */

Background:
Subclause 6.5 (Constraints):
A declaration shall declare at least a declarator, a tag, or the members of an enumeration.
It is not entirely clear what it means to ``declare'' a declarator. Neither is it clear whether or not a declarator for a member should be considered to satisfy the constraint quoted above. (Many existing implementations behave as if member declarators do not satisfy the constraint.)
Response
The Committee agrees that the quoted constraint can be read either way. Hence, a diagnostic is not required, but a program that uses such a form has undefined behavior. In the case of an aggregate, the intent was to require a tag or declarator for the aggregate itself. Thus, it is not unreasonable to issue a diagnostic for the given example. However, since the constraint can be read either way, an implementation could actually compile such a case though it is marginally useful at best.
Previous Defect Report < - > Next Defect Report