[Bug libstdc++/60921] New: 'final' allocators are incompatible with the Empty Base-class Optimisation

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 22 14:35:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60921

            Bug ID: 60921
           Summary: 'final' allocators are incompatible with the Empty
                    Base-class Optimisation
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
        Depends on: 51365

+++ This bug was initially created as a clone of Bug #51365 +++

Deriving from allocators to use the EBO doesn't work if they are final:

#include <future>
#include <memory>

template<typename T>
struct final_allocator final : std::allocator<T>
{
  final_allocator() = default;

  template<typename U>
    final_allocator(const final_allocator<U>&) { }

  template<typename U>
    struct rebind { typedef final_allocator<U> other; };
};

final_allocator<int> a;

std::promise<int> p(std::allocator_arg, a);

This affects the containers and most types in <future>. See Bug 51365 comment 6
for a partial fix.



More information about the Gcc-bugs mailing list