https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87106

--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> ---
(In reply to Arthur O'Dwyer from comment #7)
> 2) the conditionally trivial stuff is not very convenient, it seems to 
> involve a lot of code duplication. People regularly suggest attributes of the 
> form [[trivially_relocatable(condition)]] which might reduce the noise but 
> are harder to specify.
> 
> Agreed on all counts. Particularly for this attribute, I worry that the
> common use-case would be something really ugly like
> 
>     template<class T, class A>
>     class [[trivially_relocatable(
>         is_trivially_relocatable_v<A> &&
>         is_trivially_relocatable_v<typename allocator_traits<A>::pointer>
>     )]] vector {
>     };
> 
> which I hope you'd agree would be even more ridiculous than the current
> metaprogramming/duplication.

We already have a number of similar constructs, like noexcept. Still better
than duplicating the whole class IMO.

> And then on top of that, parsing an
> attribute-list would become as hard as parsing all of C++, which I don't
> think we want.

The code is already there in the parser, calling it should not be too hard.
However, we end up with questions like: when is the expression evaluated?
Instantiating some member classes too eagerly could break some code.

Reply via email to