On Mon, Jul 14, 2025 at 12:23 PM Jakub Jelinek <ja...@redhat.com> 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.
>
I would go for std::addressof if you have it already
available __builtin_addressor.

>
> > 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...
>
The observable effects of that call, is that calling relocate on array is
not supported
at compile time, because start_lifetime_as is not constexpr.

>
> As for test, I'm certainly open to suggestions.
>
>         Jakub
>
>

Reply via email to