This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119e. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2026-04-29
(From submission #892.)
Consider:
char**p; int diff = p - (const char * const *)p;
This is ill-formed per 7.6.6 [expr.add] paragraph 2, but ought to be allowed, in harmony with 7.6.9 [expr.rel] paragraph 3, 7.6.10 [expr.eq] paragraph 3, and 7.6.16 [expr.cond] paragraph 4.
Proposed resolution (approved by CWG 2026-04-28):
Change in 7.6.6 [expr.add] paragraph 2 as follows:
For subtraction, one of the following shall hold:
- both operands have arithmetic type; or
- both operands are pointers to
cv-qualified or cv-unqualified versions of the samesimilar (7.3.6 [conv.qual]) completely-defined objecttypetypes; or- the left operand is a pointer to a completely-defined object type and the right operand has integral type.