Opened 10 years ago

Closed 7 years ago

#7876 closed Bugs (fixed)

container::map fails with unions

Reported by: p.brockamp@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.52.0 Severity: Problem
Keywords: container map union Cc: matekm@…

Description

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

Change History (3)

comment:1 by Robert Matusewicz <matekm@…>, 8 years ago

Cc: matekm@… added

Hi,

This problem was fixed as in master and develop branch code provided in this ticket description compiles without an error.

comment:2 by viboes, 7 years ago

If this has already been fixed, maybe we can close the ticket.

comment:3 by Ion Gaztañaga, 7 years ago

Resolution: fixed
Status: newclosed

Fixed as no further error was reported.

Note: See TracTickets for help on using tickets.