Commit 783e243
committed
[out.ptr.t][inout.ptr.t] Get rid of TBAA-violating implication
On many platforms, we can just reuse the object/value representation of
the raw pointer stored within `(in)out_ptr_t` for `operator void**`.
However, directly use of `reinterpret_cast` violates the strict aliasing
rule ([basic.lval]/11). At the time when `out_ptr_t` and `inout_ptr_t`
were added to C++23, there was not yet any standard utility bypassing
the strict aliasing rule, and thus the notes had to indicate core UB and
were only applicable for implementations that didn't aggressively
perform type-based aliasing analysis (TBAA).
Luckily, `start_lifetime_as` was added later, making it possible to
reuse value representation without UB. This PR uses `start_lifetime_as`
in the notes, and thus makes them probably applicable for
implementations that have compatible representations for `T*` and
`void*`.
Note that `start_lifetime_as` can cause conflicts on object creation,
but conflicts are already allowed in [out.ptr.t]/5 and [inout.ptr.t]/5.1 parent 3186be7 commit 783e243
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5509 | 5509 | | |
5510 | 5510 | | |
5511 | 5511 | | |
5512 | | - | |
| 5512 | + | |
5513 | 5513 | | |
5514 | 5514 | | |
5515 | 5515 | | |
| |||
5745 | 5745 | | |
5746 | 5746 | | |
5747 | 5747 | | |
5748 | | - | |
| 5748 | + | |
5749 | 5749 | | |
5750 | 5750 | | |
5751 | 5751 | | |
| |||
0 commit comments