Issue 0032: Can an implementation permit a comma operator in a constant expression?

This issue has been automatically converted from the original issue lists and some formatting may not have been preserved.

Authors: Stephen D. Clamage, WG14
Date: 1992-12-10
Reference document: X3J11/91-036
Submitted against: C90
Status: Closed
Converted from: dr.htm, dr_032.html

In subclause 6.4, page 55, line 10, a constraint specifies that a comma operator may not appear in a constant expression (except within the operand of a sizeof operator).

At the end of the same section, page 56, line 1, it says, “An implementation may accept other forms of constant expressions.”

Does the later statement give a license to relax the earlier constraint? For example, may a conforming implementation accept

int i = (1, 2);

without issuing a diagnostic?


Comment from WG14 on 1997-09-23:

Response

No, a conforming implementation may not accept this example without issuing a diagnostic. Constraint violations always require a diagnostic (subclause 5.1.1.3). The intent of the statement “An implementation may accept other forms of constant expressions” (subclause 6.4) is to allow an implementation to accept syntactic forms, such as might be generated by the offsetof macro, that may not otherwise be semantically allowed.