Title
Definition of reachable in [ptr.launder] misses pointer arithmetic from pointer-interconvertible object
Status
c++20
Section
[ptr.launder]
Submitter
Hubert Tong

Created on 2017-01-31.00:00:00 last changed 45 months ago

Messages

Date: 2020-02-14.09:37:04

Proposed resolution:

This wording is relative to N4618.

  1. Modify [ptr.launder] as indicated:

    template <class T> constexpr T* launder(T* p) noexcept;
    

    […]

    -3- Remarks: An invocation of this function may be used in a core constant expression whenever the value of its argument may be used in a core constant expression. A byte of storage b is reachable through a pointer value that points to an object Y if there is an object Z, pointer-interconvertible with Y, such that b it is within the storage occupied by ZY, an object that is pointer-interconvertible with Y, or the immediately-enclosing array object if ZY is an array element. The program is ill-formed if T is a function type or (possibly cv-qualified) void.

Date: 2020-02-14.09:37:04

[ 2020-02 Status to Immediate on Thursday night in Prague. ]

Date: 2017-08-15.00:00:00

[ 2017-08-14, CWG telecon note ]

CWG is fine with the proposed resolution.

Date: 2017-03-15.00:00:00

[ 2017-03-04, Kona ]

Set priority to 2. Assign this (and 2860) to Core.

Date: 2017-01-31.00:00:00

Given:

struct A { int x, y; };
A a[100];

The bytes which compose a[3] can be reached from &a[2].x: reinterpret_cast<A *>(&a[2].x) + 1 points to a[3], however, the definition of "reachable" in [ptr.launder] does not encompass this case.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2020-02-24 16:02:59adminsetstatus: immediate -> wp
2020-02-14 09:37:04adminsetmessages: + msg11102
2020-02-14 09:37:04adminsetstatus: open -> immediate
2018-11-13 14:57:49adminsetstatus: core -> open
2017-10-27 17:26:06adminsetmessages: + msg9488
2017-03-14 03:14:09adminsetmessages: + msg9110
2017-03-14 03:14:09adminsetstatus: new -> core
2017-02-02 18:55:02adminsetmessages: + msg8837
2017-01-31 00:00:00admincreate