Created on 2026-04-26.00:00:00 last changed 2 weeks ago
Proposed resolution (approved by CWG 2026-06-10):
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-definedcomplete objecttypetypes; or- the left operand is a pointer to a completely-defined object type and the right operand has integral type.
[Accepted as a DR at the June, 2026 meeting.]
(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.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-08-20 06:57:03 | admin | set | status: ready -> dr |
| 2026-06-10 19:38:07 | admin | set | status: tentatively ready -> ready |
| 2026-04-29 21:37:05 | admin | set | status: open -> tentatively ready |
| 2026-04-26 05:51:02 | admin | set | messages: + msg8556 |
| 2026-04-26 00:00:00 | admin | create | |