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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-02-03
     Ever confirmed|0                           |1
          Component|c++                         |libstdc++
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jan Schultke from comment #0)
> Maybe we could add a static_assert to resize() which informs the user about
> the issue more concisely.

That's not possible in general, because there is no trait for
Cpp17DefaultInsertable. It involves a call to allocator_traits<A>::construct
which is not constrained, so checking it always succeeds.

For std::allocator we can use is_default_constructible.

Slightly more generally, we can detect whether A::construct exists, because if
it doesn't then we know that the default definition of
allocator_traits<A>::construct will be used, and we know what that does
(because program-defined specializations of allocator_traits are forbidden). So
we can use is_default_constructible in that case too.

I think this should be component=libstdc++.

Reply via email to