[Boost-bugs] [Boost C++ Libraries] #7876: container::map fails with unions

Subject: [Boost-bugs] [Boost C++ Libraries] #7876: container::map fails with unions
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-01-10 16:48:02


#7876: container::map fails with unions
----------------------------------------+-----------------------------------
 Reporter: p.brockamp@… | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: container
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: container map union |
----------------------------------------+-----------------------------------
 Hello,

 At least in boost 1.52.0 there seems to be a problem with container::map
 and the use of unions (and I suppose the problem might exist with similar
 types like container::set, etc., though I haven't tested it). Try this
 code snippet to reproduce:

 {{{
 #include <map>
 #include <boost/container/map.hpp>

 union TU {};
 void boostMapFail(void) {
   std::map <unsigned int, TU> stdTest;
   boost::container::map<unsigned int, TU> boostTest;
   TU u;
   stdTest[5U] = u; // Does compile :-)
   boostTest[5U] = u; // Fails miserably :-(
 }
 }}}

 This fails under and MSVC2005 and GCC 4.3:

 MSVC2005:
 boost/move/move.hpp(254) : error C2569: 'TU' : enum/union cannot be used
 as a base class

 GCC 4.3:
 boost/move/move.hpp:254: error: base type 'TU' fails to be a struct or
 class type

 On the contrary, using std::map instead of boost::container::map *does*
 compile without a hitch, so I would expect boost to behave identically.

 Best regards

 Peter

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