[multi_index] multiple definition errors since 86597

Hi, revision 86597 changed boost/multi_index/detail/bucket_array.hpp Add were: static const std::size_t sizes[]; static const std::size_t sizes_length; member variables, initialised with +template<> +const std::size_t bucket_array_base<true>::sizes[]={ + BOOST_PP_SEQ_ENUM(BOOST_MULTI_INDEX_BA_SIZES) +template<> +const std::size_t bucket_array_base<true>::sizes_length= + sizeof(bucket_array_base<true>::sizes)/ + sizeof(bucket_array_base<true>::sizes[0]); + Now gcc (4.8.1) reports multiple definition errors when using multi_index in different translation units: file1.cpp.o:(.rodata+0x0): multiple definition of `boost::multi_index::detail::bucket_array_base<true>::sizes_length' file2.cpp.o:(.rodata+0x0): first defined here file1.cpp.o:(.rodata+0x20): multiple definition of `boost::multi_index::detail::bucket_array_base<true>::sizes' file2.cpp.o:(.rodata+0x20): first defined here CMakeFiles/graph_test.dir/main.cpp.o:(.rodata+0x0): multiple definition of `boost::multi_index::detail::bucket_array_base<true>::sizes_length' file2.cpp.o:(.rodata+0x0): first defined here file3.o:(.rodata+0x20): multiple definition of `boost::multi_index::detail::bucket_array_base<true>::sizes' file2.cpp.o:(.rodata+0x20): first defined here According to http://stackoverflow.com/questions/1553854/template-static-variable and my current c++ template knowledge, those instantiation belong to a .cpp file to avoid this. This does not work for a header-only library, of course. The current test suite does not catch this because it only contains single file tests. Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! * voice: ++49 4257 300 ! Fährstraße 1 * fax : ++49 4257 300 ! 31609 Balge/Sebbenhausen * jhunold@gmx.eu ! Germany

Jürgen Hunold
Hi,
revision 86597 changed boost/multi_index/detail/bucket_array.hpp [...] Now gcc (4.8.1) reports multiple definition errors when using multi_index in different translation units: [...]
Thanks for spotting this. Hopefully fixed in https://svn.boost.org/trac/boost/changeset/86651 Can you check this really solves the problem? Thank you, Joaquín M López Muñoz Telefónica Digital

Hi Joaquin, On Tuesday, 12. November 2013 15:54:23 Joaquin M Lopez Munoz wrote:
Jürgen Hunold
writes: Hi,
revision 86597 changed boost/multi_index/detail/bucket_array.hpp [...] Now gcc (4.8.1) reports multiple definition errors when using multi_index in different translation units: [...]
Thanks for spotting this. Hopefully fixed in
https://svn.boost.org/trac/boost/changeset/86651
Can you check this really solves the problem?
Yes, the patch works. Thanks for the quick fix. Yours, Jürgen -- * Dipl.-Math. Jürgen Hunold ! * voice: ++49 4257 300 ! Fährstraße 1 * fax : ++49 4257 300 ! 31609 Balge/Sebbenhausen * jhunold@gmx.eu ! Germany
participants (2)
-
Joaquin M Lopez Munoz
-
Jürgen Hunold