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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|RESOLVED                    |REOPENED

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
My fix causes a regression:

#include <unordered_set>

template <typename Tp>
  struct Allocator
  {
    using value_type = Tp;

    Allocator(int) noexcept { }

    template <class T>
      Allocator(const Allocator<T>&) { }

    Tp *allocate(std::size_t n)
    { return std::allocator<Tp>().allocate(n); }

    void deallocate(Tp *p, std::size_t n)
    { std::allocator<Tp>().deallocate(p, n); }
  };

using Set = std::unordered_set<int, std::hash<int>, std::equal_to<int>,
Allocator<int>>;

static_assert( ! std::is_default_constructible<Set>::value, "" );

The standard doesn't require the trait to be true, but it was (because we
defined the default constructors as defaulted all the way down to the EBO
helper). With the change above, the EBO helper for an empty class does:

  _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }

which is ill-formed now, not implicitly deleted.

I have a patch to make it use [[no_unique_address]], so we can default it
again.

Reply via email to