[PATCH] libstdc++: library side of C++26 P2786R13 - Trivial Relocatability [PR119064]

Jason Merrill jason@redhat.com
Thu Aug 28 08:49:36 GMT 2025


On 7/14/25 6:23 AM, Jakub Jelinek wrote:
> On Mon, Jul 14, 2025 at 12:11:18PM +0200, Tomasz Kaminski wrote:
>>> +      if (__builtin_expect(__fwd, true))
>>>
>> We have a preference to use [[likely]] attribute when possible.
> 
> Ok, changed to
>        if (__fwd) [[likely]]
> in my copy.
> 
>>
>>> +       {
>>> +         for (; __first != __last; ++__first, ++__result)
>>> +           {
>>> +             if constexpr (is_array_v<_Tp>)
>>> +               std::relocate(std::begin(*__first), std::end(*__first),
>>> +                             &(*__result)[0]);
>>>
>> We should use std::addressof or __builtin_addressof  here to avoid using
>> operator& found by ADL.
> 
> Ok.  Which one though?  I see all of std::addressof, std::__addressof and
> __builtin_addressof used heavily.
> 
>> The standard uses start_lifetime_as here (
>> https://eel.is/c++draft/memory#obj.lifetime-18.3.1),
> 
> I know, but P2590R2 is not implemented yet and as written in
> https://gcc.gnu.org/PR106658 I have actually no idea what needs to be done
> if anything on the compiler side.  Because at least the GIMPLE model
> basically allows placement new anywhere without anything in the IL marking
> up that the dynamic type has changed.  Though perhaps for constant
> expression evaluation we want something...

Note this is fixed by PR121068 (r16-3022).

Jason



More information about the Libstdc++ mailing list