[Boost-bugs] [Boost C++ Libraries] #12789: Instantiating bimap with all three "additional" template parameter fails to compile.

Subject: [Boost-bugs] [Boost C++ Libraries] #12789: Instantiating bimap with all three "additional" template parameter fails to compile.
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-01-25 15:21:49


#12789: Instantiating bimap with all three "additional" template parameter fails to
compile.
------------------------------+---------------------
 Reporter: jonathan.haigh@… | Owner: matias
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: bimap
  Version: Boost 1.55.0 | Severity: Problem
 Keywords: |
------------------------------+---------------------
 The following test program fails to compile.

 {{{#!c++
 #include <boost/bimap.hpp>
 #include <memory>

 void test() {
   boost::bimap<int, int, boost::bimaps::left_based,
 boost::bimaps::with_info<int>, std::allocator<void>> map;
 }
 }}}

 The compile error from g++ 4.9.2 starts with:

 {{{
 jhaigh_at_growler:~/tmp/tmp$ g++ -std=c++11 bimap_error.cpp
 In file included from /usr/include/boost/bimap/bimap.hpp:61:0,
                  from /usr/include/boost/bimap.hpp:13,
                  from bimap_error.cpp:1:
 /usr/include/boost/bimap/detail/bimap_core.hpp: In instantiation of ‘class
 boost::bimaps::detail::bimap_core<int, int, boost::bimaps::left_based,
 boost::bimaps::with_info<int>, std::allocator<void> >’:
 /usr/include/boost/bimap/bimap.hpp:133:7: required from ‘class
 boost::bimaps::bimap<int, int, boost::bimaps::left_based,
 boost::bimaps::with_info<int>, std::allocator<void> >’
 bimap_error.cpp:5:106: required from here
 /usr/include/boost/bimap/detail/bimap_core.hpp:410:7: error: no class
 template named ‘rebind’ in
 â€˜boost::bimaps::detail::manage_additional_parameters<boost::bimaps::left_based,
 boost::bimaps::with_info<int>, std::allocator<void> >::case_SHA::allocator
 {aka struct boost::bimaps::with_info<int>}’
 ...
 }}}

 Boost thinks my with_info parameter is an allocator! The full compiler
 output will be attached, but I think this is enough to see the problem.

 It looks like the cause is the case_SHA struct in
 boost/bimap/detail/manage_additional_parameters that deals with the case
 when all three additional template parameters are given to bimap:

 {{{#!c++
 template< class AP1, class AP2, class AP3 >
 struct manage_additional_parameters
 {
 ...
     struct case_SHA
     {
         typedef AP1 set_type_of_relation;
         typedef AP2 allocator;
         typedef BOOST_DEDUCED_TYPENAME AP2::value_type additional_info;
     };
 }}}
 AP2 is used for both the allocator type and the additional_info type. I
 think allocator should be typedefed to AP3, not AP2.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/12789>
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:20 UTC