This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2025-10-11
(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).
Possible resolution:
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 the (possibly materialized) E 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.