On Mon, 25 Aug 2025 at 16:12, Tomasz Kaminski <[email protected]> wrote:
>
>
>
>
> On Mon, Aug 25, 2025 at 12:02 PM Jakub Jelinek <[email protected]> wrote:
>>
>> Hi!
>>
>> I'd like to ping the
>>
>> libstdc++, v2: library side of C++26 P2786R13 - Trivial Relocatability 
>> [PR119064]
>> https://gcc.gnu.org/pipermail/libstdc++/2025-July/062605.html
>
> // I lost the e-mial, so I now sure how to respond to it. Are there any 
> instruction how to do so?

I don't think there's any way to retrieve them with the current
mailing list software, at least not in a way that's compatible with
Gmail.

I've bounced the email to you now, which means sending my local copy
to you as though it had originally been sent to you. You should have a
copy in your inbox now.


>
> With Jason changes, I was able constexpr relocate arrays, using following 
> example code:
> template<typename T>
> union trivial_union
> {
>   constexpr trivial_union() {}
>   constexpr ~trivial_union() {}
>
>   T mem;
> };
>
>
> template<typename X>
> constexpr bool
> test_constexpr_relocate_array()
> {
>   using XA = X[2];
>   trivial_union<XA[10]> a,c;
>
>   XA *sf, *sl, *sr;
>   ::new(&a.mem[1][0]) X(11);
>   ::new(&a.mem[1][1]) X(12);
>   sf = &a.mem[1];
>   for (int i = 0; i < 5; ++i)
>     {
>       ::new(&a.mem[i + 2][0]) X{13 + 2 * i};
>       ::new(&a.mem[i + 2][1]) X{14 + 2 * i};
>       sl = &a.mem[i+2];
>     }
>   ++sl;
>   ::new(&c.mem[3][0]) X(42);
>   ::new(&c.mem[3][1]) X(43);
>   sr = &c.mem[3];
>   (*sr)[0].~X();
>   (*sr)[1].~X();
>   VERIFY( std::relocate(sf, sl, sr) == sr + 6 );
>   for (int i = 0; i < 6; ++i)
>     {
>       VERIFY( (*sr)[0].s == 2 * i + 11 && (*sr)[1].s == 2 * i + 12 );
>       (*sr)[0].~S();
>       (*sr)[1].~S();
>       ++sr;
>     }
>   return true;
> }
>  static_assert(test_constexpr_relocate_array<S>());
>
> However, relocate for array should not be usable at compile time, because it 
> is specified to use start_lifetime_as,
> that is not marked as constexpr. This needs to be adjusted, for example by 
> calling non-constexpr function from std::relocate.
>
> Could you also adjsut the test file in similar manner as I did before, i.e. 
> make them templated on the type that will be relocated
> (S or T in your example), I use X as placeholder, and then in main invoke 
> both:
> test_constexpr_relocate_array<S>();
> test_constexpr_relocate_array<T>();
>
> Tomasz
>
>>
>>
>>
>> and
>>
>> libstdc++, v2: Implement C++26 P3378R2 - constexpr exception types [PR121114]
>> https://gcc.gnu.org/pipermail/libstdc++/2025-August/062947.html
>>
>> patches (for the latter as I wrote in the mail another possibility would be
>> add more smaller headers, I can work on that if that is preferred but would
>> like guidance on naming those).
>>
>> Thanks
>>
>>         Jakub
>>

Reply via email to