[Boost-bugs] [Boost C++ Libraries] #9328: Error initializing a boost:container's allocator with a reference.

Subject: [Boost-bugs] [Boost C++ Libraries] #9328: Error initializing a boost:container's allocator with a reference.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-10-30 22:17:17


#9328: Error initializing a boost:container's allocator with a reference.
---------------------+------------------------------------------------
 Reporter: jbell@… | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.54.0
 Severity: Problem | Keywords: container scoped_allocator_adaptor
---------------------+------------------------------------------------
 Consider the following:

 struct arena;

 struct A : std::allocator<int>
 {
     A(arena {}
     A(arena*) {}
 };

 typedef
 boost::container::vector<int,boost::container::scoped_allocator_adaptor<A>
> avector;

 void foo(arena a)
 {
     avector v1(a); // error: can't bind a mutable & to a const&
     avector v2(&a); // fine
     avector v3(A(a)); // fine
     avector v3(A(&a)); // fine
 }

 The initialization of v1 generates the following compilation error (under
 GCC 4.4.7):

 /opt/scidb/13.9/3rdparty/boost/include/boost/container/scoped_allocator.hpp:
 In constructor
 â€˜boost::container::container_detail::scoped_allocator_adaptor_base<OuterAlloc,
 true, boost::container::container_detail::nat,
 boost::container::container_detail::nat,
 boost::container::container_detail::nat,
 boost::container::container_detail::nat,
 boost::container::container_detail::nat,
 boost::container::container_detail::nat,
 boost::container::container_detail::nat,
 boost::container::container_detail::nat,
 boost::container::container_detail::nat,
 boost::container::container_detail::nat>::scoped_allocator_adaptor_base(const
 OuterA2&) [with OuterA2 = ARENA, OuterAlloc = A]’:
 /opt/scidb/13.9/3rdparty/boost/include/boost/preprocessor/iteration/detail/local.hpp:34:
 instantiated from ‘boost::container::scoped_allocator_adaptor<OuterAlloc,
 P0, P1, P2, P3, P4, P5, P6, P7, P8, P9>::scoped_allocator_adaptor(const
 OuterA2&) [with OuterA2 = ARENA, OuterAlloc = A, Q0 =
 boost::container::container_detail::nat, Q1 =
 boost::container::container_detail::nat, Q2 =
 boost::container::container_detail::nat, Q3 =
 boost::container::container_detail::nat, Q4 =
 boost::container::container_detail::nat, Q5 =
 boost::container::container_detail::nat, Q6 =
 boost::container::container_detail::nat, Q7 =
 boost::container::container_detail::nat, Q8 =
 boost::container::container_detail::nat, Q9 =
 boost::container::container_detail::nat]’
 /local/mem/src/tests/unit/ArenaUnitTests.h:743: instantiated from here
 /opt/scidb/13.9/3rdparty/boost/include/boost/container/scoped_allocator.hpp:890:
 error: no matching function for call to ‘A::A(const ARENA&)’
 /local/mem/src/tests/unit/ArenaUnitTests.h:736: note: candidates are:
 A::A(ARENA*)
 /local/mem/src/tests/unit/ArenaUnitTests.h:735: note:
 A::A(ARENA&)
 /local/mem/src/tests/unit/ArenaUnitTests.h:734: note:
 A::A(const A&)

 Notice that the implementation of scoped_allocator_adaptor is attempting
 to initialize the adaptor with a *const* reference to an ARENA when a
 mutable reference was in fact supplied to the container's constructor.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9328>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC