[Bug libstdc++/108619] Compilation error if the construct method of the allocator isn't implemented and the detructor of value_type is private

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jan 31 22:07:07 GMT 2023


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Keywords|                            |rejects-valid

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The bug is here in std::allocator_traits:

      template<typename _Tp, typename... _Args>
        static _GLIBCXX14_CONSTEXPR
        _Require<__and_<__not_<__has_construct<_Tp, _Args...>>,
                               is_constructible<_Tp, _Args...>>>
        _S_construct(_Alloc&, _Tp* __p, _Args&&... __args)

It uses std::is_constructible, which is false because std::is_destructible<a>
is false.

We need to check if a placement new expression is valid, so that we don't
consider the destructor.


More information about the Gcc-bugs mailing list