Boost logo

Boost Users :

Subject: [Boost-users] [Multi Index] equal_range from templated function fails to compile with gcc 4.6.1
From: Jacob Metcalfe (cubathy_at_[hidden])
Date: 2012-01-08 19:01:06


I’m having issues compiling some multi_index_container code after upgrading
from gcc 4.3.4 to gcc 4.6.1 and wondering if anyone can shed some light.
Perhaps this should be directed to gcc, but I have not been able to reduce
this to not include multi_index. The contrived code below is the furthest I
have been able to reduce the problem so far:****

** **

  1 #include <boost/multi_index_container.hpp>****

  2 #include <boost/multi_index/ordered_index.hpp>****

  3 #include <boost/multi_index/member.hpp>****

  4 #include <boost/multi_index/composite_key.hpp>****

  5****

  6 using namespace boost::multi_index;****

  7****

  8 struct Data{****

  9 double _d;****

10 };****

11****

 12 typedef multi_index_container< Data,****

13 indexed_by< ordered_non_unique<****

14 composite_key< Data, member<Data, double, &Data::_d> >****

15 > >****

16 > Map;****

17****

 18 template <int T>****

19 void foo(){****

20 Map mi;****

21 mi.get<0>().equal_range(boost::make_tuple(0.0));****

22 }****

23 int main(){****

24 foo<5>();****

25 }****

** **

The failures from gcc 4.6.1 are:****

** **

boost/multi_index/detail/index_base.hpp: In function 'void foo() [with int
T = 5]':****

boost/multi_index/detail/index_base.hpp:49:47: error: 'typedef struct
boost::multi_index::detail::index_node_base<Data,
std::allocator<Data> > boost::multi_index::detail::index_base<Data, boost
::multi_index::indexed_by<boost::multi_index::ordered_non_unique<boost
::multi_index::composite_key<Data, boost::multi_index::member<Data, double,
&Data::_d> > > >, std::allocator<Data> >::node_type' is protected****

tstmi.cpp:24:10: error: within this context****

** **

** **

This code appears to compile fine under 4.3.4 and would compile with 4.6.1
if the useless template at line 18 was removed.****

** **

Many thanks



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net