Created on 2020-10-28.00:00:00 last changed 1 month ago
Proposed resolution (approved by CWG 2025-11-05):
Change in 7.3.3 [conv.array] as follows:
Anlvalue or rvalueexpression E of type “array of N T” or “array of unknown bound of T” can be converted to a prvalue of type “pointer to T”.TheIf E is a prvalue, the temporary materialization conversion (7.3.5 [conv.rval]) is applied.TheIf the result of E (possibly converted) is an object whose type is similar to the type of E, the result is a pointer to the first element of the array; otherwise, the behavior is undefined.
(From submission #707.)
Consider:
int a[5]; int *p1 = &a[0]; // points to the first element of a auto pa = reinterpret_cast<int(*)[5]>(p1); int *p2 = *pa; // valid array-to-pointer conversion?
If a glvalue of array type is subject to the array-to-pointer conversion, the behavior should be undefined if the type of the result of the glvalue is not an array (see 7.6.1.5 [expr.ref] paragraph 10 for the class member access case).
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2025-11-07 07:33:50 | admin | set | status: tentatively ready -> ready |
| 2025-11-05 18:54:12 | admin | set | messages: + msg8219 |
| 2025-11-05 18:54:12 | admin | set | status: open -> tentatively ready |
| 2020-10-28 00:00:00 | admin | create | |